[rspec-devel] [ rspec-Bugs-6760 ] fatal error when accessing nested finders in rspec

noreply at rubyforge.org noreply at rubyforge.org
Sat Nov 18 00:52:43 EST 2006


Bugs item #6760, was opened at 2006-11-18 00:52
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6760&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Chad Humphries (spicycode)
Assigned to: Nobody (None)
Summary: fatal error when accessing nested finders in rspec

Initial Comment:
We have several models that have relationships defined like this (on edge rails):


has_many :items do
  def incomplete
    find(:all, :conditions => 'completed_at is null')
  end
  def complete
    find(:all, :conditions => 'completed_at is not null')
  end
end

This let's you do things like object.items.incomplete and object.items.complete... however in rspec if you try to use a model that has this type of collection in 0.7.X and up you get a repeating error (2-3 pages of it) after a long delay (30-90 seconds) that says something along the lines of:

[project_path]/config/../vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:98:in `method_missing'

If you remove the nested finders (ie change it to just be has_many :items) it works fine again.

I'll try to investigate and see if I can find the cause, submitting as bug as it's rather late here.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6760&group_id=797


More information about the rspec-devel mailing list