How to decorate nested attributes (associations) with Draper in Rails 3? -


my environment:

i'm using nested resources , having trouble figuring out declare decorator.

#app/controllers/users_controller.rb def show   @user = userdecorator.find(params[:id])   @items = @user.items end  #app/controllers/items_controller.rb def show   @item = @user.items.find(params[:id]) end 

i tried replacing items itemdecorator , didn't work. should putting it?

i know draper has issues nested resources in forms, isn't form!

as far i've understood problem correctly, you've model user has many items, items not decorated?

so add userdecorator:

class userdecorator < draper::base   decorates :user   decorates_association :items #, :with => :item     [..] end  class itemdecorator < draper::base   decorates :item    [..] end 

have on the source.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -