Have just installed rails 2.2.2 My application has many has_many_trough associtions. With rails 2.2.2 I got an error trying to access some of them Event Model has_many :people,:through => :participants has_many :participants Person Model has_many :events,:through => :participants has_many :participants Table participants has the fields, event_id, person_id, role Now when I try this test @event=Event.find(:first) @event.people.each {|person| puts ''EVENT ''+person.name} I got the error stack level too deep (concerns method missing) debugging shows that is is the method each that is missing. More debugging shows that @event.people seems not to be an array When I try puts @event.people I got the error can''t convertActiveRecord::Associations::HasManyThroughAssociation into String I did not have that error in rails 2.0 and it shows up only for some has_many ass Anyone that has had the same problem ? Any work-arounds ? Thanks or any help -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
On 16 Jan 2009, at 11:35, Hans Marmolin wrote:> > Have just installed rails 2.2.2 My application has many > has_many_trough > associtions. With rails 2.2.2 I got an error trying to access some of > them > > Event Model > has_many :people,:through => :participants > has_many :participants > Person Model > has_many :events,:through => :participants > has_many :participants > Table participants has the fields, event_id, person_id, role >Do you need to create the :participants association before you create associations through it ? Fred> Now when I try this test > @event=Event.find(:first) > @event.people.each {|person| puts ''EVENT ''+person.name} > > I got the error stack level too deep (concerns method missing) > debugging shows that is is the method each that is missing. > More debugging shows that @event.people seems not to be an array > When I try puts @event.people I got the error can''t > convertActiveRecord::Associations::HasManyThroughAssociation into > String > > I did not have that error in rails 2.0 and it shows up only for some > has_many ass > Anyone that has had the same problem ? > Any work-arounds ? > Thanks or any help > -- > Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 16 Jan 2009, at 11:35, Hans Marmolin wrote: > >> has_many :events,:through => :participants >> has_many :participants >> Table participants has the fields, event_id, person_id, role >> > > Do you need to create the :participants association before you create > associations through it ? > > FredWhat do you mean with before ? However I changed the order to has_many :participants has_many :events,:through => :participants And that does not solve the problem After som more debugging it seems like all my HasManyThroughAssociation have the same problem -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Problem solved !!!!!!!!!!!!! ===================I have now made a lot more debugging that showed that the bad code was the plugin will paginate. I had an old version and when I updated to the last version (for rails 2.2.2) of will paginate everything works fine again. The lesson learned. Always update your plugins when you update rails !!!!!!!! -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---