I get "stack level too deep" error when using a named scope

Posted by Brian Roisentul on Stack Overflow See other posts from Stack Overflow or by Brian Roisentul
Published on 2010-06-16T17:23:34Z Indexed on 2010/06/16 18:12 UTC
Read the original article Hit count: 183

Filed under:

I'm using ruby on rails 2.3.8 and when I write the syntax shown below I get the "stack level too deep" error message.

The model is called Announcement and the line of the error looks like this:

Tag.find(category_id).announcements.published

Where published is

named_scope :published, :conditions => "announcements.state = 'published'"

I use this named scope in many other places and it works fine.

What am I doing wrong? (the relationship between Tag and Announcement model is ok because if I remove the ".published" method from that line it works just fine).

© Stack Overflow or respective owner

Related posts about ruby-on-rails