Can anyone help me with this?
I have a habtm relationship. I defined a named_scope on one side of it. It works fine except when I chain it. For example:
[code] class Category < ActiveRecord::Base has_and_belongs_to_many :items end
class Item < ActiveRecord::Base has_and_belongs_to_many :categories
named_scope :cat, lambda {|cat| {:include => :categories, :conditions => ["categories.id = ?", cat]}} end [/code]
Simple. Easy. Normal, right?
But, let's see I have the following in my join table "categories_items": category_id | item_id