2008年11月10日 星期一

with_options

http://railscasts.com/episodes/42-with-options

map.with_options :controller => 'membercenter' do |t|
t.partner_login 'membercenter/plogin', :action => 'partner_login'
t.partner_signup 'membercenter/psignup', :action => 'partner_signup'
t.partner_logout 'membercenter/plogout', :action => 'partner_logout'
t.default 'membercenter/:action'
end


def index
FaqCommon.with_options :order => "created_at DESC", :limit => 9 do |faqcommon|
@member_faqs = faqcommon.find(:all, :conditions => ["title_type = ?", 0] )
@use_faqs = faqcommon.find(:all, :conditions => ["title_type = ?", 1] )
end
end

沒有留言: