Hi, I have a bit of code like so: @city = City.find(params[:id]) @event_pages, @events = paginate :events, :per_page => 10, :joins => ["inner join locations on events.location_id locations.id"], :conditions => ["locations.city_id = ?", @city.id] Strangely, when I want to list @events, everything seems to be working fine, but the event objects are getting the id of location instead of the event. The rest of the event columns/attributes are getting the right values. Only id happens to be from the respective location! I''m confused. Looks like a rails bug, any hints? TIA, Vamsee. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
add :select => ''events.*'' ActiveRecord does a SELECT * by default. On 7/20/07, vamsee <vamlists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > I have a bit of code like so: > > @city = City.find(params[:id]) > @event_pages, @events = paginate :events, :per_page => 10, > :joins => ["inner join locations on events.location_id > locations.id"], > :conditions => ["locations.city_id = ?", @city.id] > > Strangely, when I want to list @events, everything seems to be working > fine, but the event objects are getting the id of location instead of > the event. The rest of the event columns/attributes are getting the > right values. Only id happens to be from the respective location! I''m > confused. Looks like a rails bug, any hints? > > TIA, > Vamsee. > > > > >-- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rick Olson wrote:> add :select => ''events.*'' > > ActiveRecord does a SELECT * by default. >D''oh. I should have tried that. Thanks, it works. Vamsee. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---