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).
EDIT:
The model's relationships are:
class Tagging < ActiveRecord::Base
belongs_to :announcement
belongs_to :tag
end
class Tag < ActiveRecord::Base
has_many :taggings
has_many :announcements, :through => :taggings
end
class Announcement < ActiveRecord::Base
has_many :taggings
has_many :tags, :through => :taggings