I have two models;
class Foo
belongs_to :bar
end
class Bar
has 1, :foo
end
This all works fine, relationship working fine and so on. The requirement arose for us to override the "all" method on Foo, to always put a condition into any query. We did this like so;
class Foo
def self.all(opts = {})
super(opts.merge(:hidden => false))
end
end
And all that works too, but when I run the following command;
Foo.all.bar
It gives me the following error:
"condition :hidden does not map to a property in Bar"
That line worked totally fine before I overrode 'all'. I don't understand why it's applying "hidden" to the 'bar' object rather than the 'foo' object!