skip to main
|
skip to sidebar
memo temp
2008年12月18日 星期四
All About Layouts
railscast All About Layouts
layout 幾個常用的用法
# projects_controller.rb
layout :user_layout
#或者可以直接傳 string, layout :application
def index
@projects = Project.find(:all)
render :layout => 'projects'
#除了上面這個可以在 render 時再去指定, 也可以 :layout => false 選擇不要layout了
end
protected
#如果 layout :user_layout 傳的是symbol 就會找method
def user_layout
if current_user.admin?
"admin"
else
"application"
end
end
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
state chart
eb
關於我自己
Lake
檢視我的完整簡介
pie chart
網誌存檔
►
2010
(1)
►
11月
(1)
►
2009
(26)
►
1月
(26)
▼
2008
(26)
▼
12月
(26)
[HTML] IE 表單 Enter 的 Bug
ruby memo
rails default mode
deploy
Gem dependencies
liquid,dynamic content
All About Layouts
rails 2.2 extra, delegate,gem
each_with_object,inject
header, redirect_to , render js, polymorphic_path
Rescue from dispatching, layout mailer
Shallow Routes, Resources With Specific Actions
etag,last_modified,Get
rails, thread-safe
alias_method_chain
rails2.2 extra, dynamic finder
join,include
sql,DATE,group by
Block in views, concat, capture, content_for,yield...
memoizable,rails2.2
overwrite attr_writer,=
rails I18n sample
rails execute sql
jquery parse xml
google ajax library api
using jquery in rails,jquery, rails,form,reset,esc...
沒有留言:
張貼留言