· 1 min read
Screencast: Decent Exposure
Download:
Download(21.9 MB, 9:55) Alternativer Download für iPod & Apple TV(21.2 MB, 9:55)
Resourcen:
Quellcode:
[ruby] # articles_controller.rb expose(:articles) { Article.order(:name) } expose(:article)
# or without decent_exposure
def articles @articles ||= Article.order(:name) end helper_method :articles
def article @article ||= params[:id] ? Article.find(params[:id]) : Article.new(params[:article]) end helper_method :article
# comments_controller.rb expose(:article) expose(:comments) { article.comments } expose(:comment) [/ruby]