Rails 3 2 counter cache not updating Hot naked granny chat
However, Active Record will not automatically identify bi-directional associations that contain a scope or any of the following options: association creates a one-to-one match with another model.In database terms, this association says that this class contains the foreign key.
You could set that up this way: association creates a direct many-to-many connection with another model, with no intervening model.
This association indicates that each instance of a model contains or possesses one instance of another model.
For example, if each supplier in your application has only one account, you'd declare the supplier model like this: Depending on the use case, you might also need to create a unique index and/or a foreign key constraint on the supplier column for the accounts table.
For example, you might have a picture model that belongs to either an employee model or a product model.
Here's how this could be declared: In designing a data model, you will sometimes find a model that should have a relation to itself.