Given the following tables in ActiveRecord:
I donโt know how to express that the author receives a different amount depending on the publication, but the authors working in the same publication have different rates:
- John publishes an article in Foo for $ 300
- John publishes an article in Bar for $ 350
- John publishes an article in the Base for $ 400.
- Dick publishes $ 250 Foo article
- Dick publishes an article in Bar for $ 400
and etc.
What connection am I trying to describe?
At the moment, I have a table of "bids" with author _id, site
_id columns and quantity. Given publish.id and author.id, I get the article value using
cost = Rate.find(:first, :conditions => ["author_id = ? and site_id = ?", author.id, site.id]).rate
, , , , , "", "".
, , , - ", ... ", , Google.