First, I am very new to ruby and rails. Searching for "references" is
really tough, and so I've finally come here.
I'm trying to create a scaffold. Let's say a Business and a School both
can have a single Address (not shared). In a different case, an Offer
has an OfferType (with just a type_id and description). Also, a
Business can have many Offers.
(I've stripped off most of the unrelated columns, like last_name,
I'm wondering (in about this order):
a) Am I doing this right?
b) What the difference would be if I used Address business:belongs_to
user:belongs_to instead of references?
c) Is the Business address:has_one redundant with Address
business:references? If not, what does it do? What about the has_many?
d) Will this generate join tables for me? And I don't need to specify
xxxxx_id's anywhere in these relationships?
./script/generate scaffold Business address:has_one offer:has_many
./script/generate scaffold School address:has_one name:string
./script/generate scaffold Address business:references school:references
./script/generate scaffold Offer business:references offerType:has_one
./script/generate scaffold OfferType image:has_one name:string
(I'm on Ruby 1.8.7 and Rails 2.3.8.)