Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8063579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:05:20+00:00 2026-06-05T11:05:20+00:00

My environment: Rails 3.2 with draper gem I’m using nested resources and having trouble

  • 0

My environment:

  • Rails 3.2
    • with draper gem

I’m using nested resources and having trouble figuring out where to declare the 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 with ItemDecorator and it didn’t work. Where should I be putting it?

I know that Draper has issues with nested resources in forms, but this isn’t a form!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:05:22+00:00Added an answer on June 5, 2026 at 11:05 am

    As far as I’ve understood your problem correctly, you’ve a model user which has many items, but your items were not decorated?

    So add to your UserDecorator:

    class UserDecorator < Draper::Base
      decorates :user
      decorates_association :items #, :with => :item 
    
      [..]
    end
    
    class ItemDecorator < Draper::Base
      decorates :item
    
      [..]
    end
    

    Have a look on the source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

environment/cucumber.rb: ... # gem dependencies config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless
I'm coding a Rails project in a Windows environment and using Eclipse (with the
Environment: Rails 3.2.3 Mac OS X Lion Ruby-1.9.3-p194 (MRI) I have a rails app
I tried using logger.info Rails Environment #{RAILS.env} but I'm getting an error: uninitialized constant
I'm trying to test out scrobbler/scrobbler2 gem (http://scrobbler.rubyforge.org/) in irb. The problem I'm having
I cannot figure out why rails/ruby cannot see this gem, despite each telling me
I'm having a stack level too deep error using Ruby 1.8.7 with Rails 3.0.4
I'm having trouble getting a working rails console, and I'm not sure why. I've
I am using gem 1.3.7, rails 2.3.5 and ruby 1.8.7 (2008-08-11 patchlevel 72). While
Environment: Rails 3.0.1 Ruby 1.8.7 MySQL 5.5.16 Community server...Jdk 1.6 gem 'sunspot_rails' gem 'sunspot_solr'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.