Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Additional attributes on select don't appear.

#5932

In rails 3 if I have a scope and add extra attributes on select, they won't be present in the result.

example:

results=CommunityType.my_scope.select('community_types.*,communities.title as fasd')
results[0].fasd #raises NoMethodError
my_scope implementation...
scope :my_scope, lambda { includes({:communities => :memberships}) & Community.public }

This was working in previous versions of rails.

Reported by jp.blanco · November 8th, 2010 @ 05:24 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Neeraj Singh
    Neeraj Singh
    • Importance changed from to Low

    Can you post migration and model info for CommunityType, Community and Membership? I will take a look at this issue.

    November 10th, 2010 @ 09:57 PM

  2. jp.blanco
    jp.blanco

    This is the schema for those models,

     create_table "communities" do |t|
        t.string   "title"
        t.integer  "community_type_id"
      end
    
      create_table "community_types" do |t|
        t.string   "code"
        t.string   "title"
      end
    
    
      create_table "memberships" do |t|
        t.integer  "user_id"
        t.datetime "created_at"
        t.datetime "updated_at"
        t.integer  "community_id"
      end
    

    Thanks in advance

    November 11th, 2010 @ 02:12 PM

  3. Neeraj Singh
    Neeraj Singh

    Can you post model with scope so that I could reproduce the problem. Thanks

    November 12th, 2010 @ 06:39 PM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 12th, 2011 @ 07:18 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 12th, 2011 @ 07:18 PM