Draiken
2011-Jun-15 19:01 UTC
[3.1.0.rc4] Problem with reflections being empty causing whiny nil
Hi, I have an engine that worked perfectly on rails 3.0.x and now is breaking on a simple method. Basically it creates categories that can have subcategories but all with the same model. eg: class Category < ActiveRecord::Base belongs_to :parent, :class_name => ''Category'' has_many :subcategories, :class_name => ''Category'', :foreign_key => :parent_id end basically, what is happening is, everytime I call the category.subcategories method I get this error: NoMethodError: undefined method `association_class'' for nil:NilClass from /Users/draiken/.rvm/gems/ruby-1.9.2-p180@eujafui/gems/ activesupport-3.1.0.rc4/lib/active_support/whiny_nil.rb:48:in `method_missing'' from /Users/draiken/.rvm/gems/ruby-1.9.2-p180@eujafui/gems/ activerecord-3.1.0.rc4/lib/active_record/associations.rb:163:in `association'' from /Users/draiken/.rvm/gems/ruby-1.9.2-p180@eujafui/gems/ activerecord-3.1.0.rc4/lib/active_record/associations/builder/ association.rb:41:in `block in define_readers'' I''ve noticed for some reason, category.reflections is empty I''ve tried debugging and I really don''t know what is wrong, since nothing changed besides the rails 3.1 Thanks in advance -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Luiz Felipe Garcia Pereira
2011-Jun-15 19:35 UTC
Re: [3.1.0.rc4] Problem with reflections being empty causing whiny nil
Discovered it was an incompatibility issue with another gem ''has_many_polymorphs'' On Wed, Jun 15, 2011 at 4:01 PM, Draiken <luiz.felipe.gp@gmail.com> wrote:> Hi, I have an engine that worked perfectly on rails 3.0.x and now is > breaking on a simple method. > Basically it creates categories that can have subcategories but all > with the same model. > eg: > > class Category < ActiveRecord::Base > belongs_to :parent, :class_name => ''Category'' > has_many :subcategories, :class_name => ''Category'', :foreign_key > => :parent_id > end > > basically, what is happening is, everytime I call the > category.subcategories method > I get this error: > > NoMethodError: undefined method `association_class'' for nil:NilClass > from /Users/draiken/.rvm/gems/ruby-1.9.2-p180@eujafui/gems/ > activesupport-3.1.0.rc4/lib/active_support/whiny_nil.rb:48:in > `method_missing'' > from /Users/draiken/.rvm/gems/ruby-1.9.2-p180@eujafui/gems/ > activerecord-3.1.0.rc4/lib/active_record/associations.rb:163:in > `association'' > from /Users/draiken/.rvm/gems/ruby-1.9.2-p180@eujafui/gems/ > activerecord-3.1.0.rc4/lib/active_record/associations/builder/ > association.rb:41:in `block in define_readers'' > > I''ve noticed for some reason, category.reflections is empty > > I''ve tried debugging and I really don''t know what is wrong, since > nothing changed besides the rails 3.1 > > Thanks in advance > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- Luiz Felipe G. Pereira -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.