Hi all, i''m developing an application with 40 tables that they have relations between them, in my products_list when i render the results in my view everything worked fine but from one day i i get an error: NoMethodError in Admin/product#products_list Showing app/views/admin/product/products_list.rhtml where line #35 raised: undefined method `re_products_type'' for #<ReproductsSubtype: 0xb731b624> Extracted source (around line #35): 32: <% for item in @products %> 33: <tr class="listLine<%= cycle(1,0) %>"> 34: <td><%= item.id %></td> 35: <td><%= item.re_products_subtype.re_products_type.type_name %></ td> is strange because never happened since a month that i have started working on this application but if i restart apache everything is ok but after 5 minutes i get the same error again. I''m the only developer that work on this...this thing is driving me crazy. Any solutions or ideas please? thanks in advance and sorry about my english! --~--~---------~--~----~------------~-------~--~----~ 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
2007-Nov-29 21:22 UTC
Re: Problems with activerecord associations between tables
On 29 Nov 2007, at 19:18, netbomb wrote:> > Hi all, > i''m developing an application with 40 tables that they have relations > between them, in my > products_list when i render the results in my view everything worked > fine but from one day i i get an error: > NoMethodError in Admin/product#products_list >Does this only happen in development mode? Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ilan Berci
2007-Nov-29 21:42 UTC
Re: Problems with activerecord associations between tables
netbomb wrote:> Hi all,> > 32: <% for item in @products %> > 33: <tr class="listLine<%= cycle(1,0) %>"> > 34: <td><%= item.id %></td> > 35: <td><%= item.re_products_subtype.re_products_type.type_name > %></ > td> > > is strange because never happened since a month that i have started > working on this application but if i restart apache everything is ok > but after 5 minutes i get the same error again. I''m the only developer > that work on this...this thing is driving me crazy. > Any solutions or ideas please? > thanks in advance and sorry about my english!Show us app/models/re_products_subtype.rb and app/models/re_products_type.rb -- 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 -~----------~----~----~----~------~----~------~--~---
Ayyanar Aswathaman
2007-Nov-30 04:03 UTC
Re: Problems with activerecord associations between tables
Iam facing the same problem only in the development mode. If you find the re_products_subtype directly instead of getting it from item it may work. -- 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 -~----------~----~----~----~------~----~------~--~---
Yes i''m in development mode, i figured out doing as showen below> ReProductsType.find_by_id(item.re_products_subtype.re_products_type_id).type_name but i prefer as before... My models: class ReProductsSubtype < ActiveRecord::Base belongs_to :re_products_type end class ReProductsType < ActiveRecord::Base has_one :re_products_subtype end I can do an explicit sql query to have better performace, but i would like to understand whyt this happen! Thanks to all On 30 Nov, 05:03, Ayyanar Aswathaman <rails-mailing-l...@andreas- s.net> wrote:> Iam facing the same problem only in the development mode. > If you find the re_products_subtype directly instead of getting it from > item it may work. > > -- > Posted viahttp://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
2007-Nov-30 08:49 UTC
Re: Problems with activerecord associations between tables
On 30 Nov 2007, at 08:34, netbomb wrote:> > Yes i''m in development mode, i figured out doing as showen below> >I''ve seen some funkiness due to the autoloading stuff. major culprits include using require to require things that could be autoloaded Fred> ReProductsType > .find_by_id(item.re_products_subtype.re_products_type_id).type_name > but i prefer as before... > > My models: > class ReProductsSubtype < ActiveRecord::Base > belongs_to :re_products_type > end > > class ReProductsType < ActiveRecord::Base > has_one :re_products_subtype > end > > I can do an explicit sql query to have better performace, but i would > like to understand whyt this happen! > Thanks to all > > On 30 Nov, 05:03, Ayyanar Aswathaman <rails-mailing-l...@andreas- > s.net> wrote: >> Iam facing the same problem only in the development mode. >> If you find the re_products_subtype directly instead of getting it >> from >> item it may work. >> >> -- >> Posted viahttp://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 > -~----------~----~----~----~------~----~------~--~--- >