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,
etc...)

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
name:string first_name:string

./script/generate scaffold School address:has_one name:string

./script/generate scaffold Address business:references school:references
address1:string

./script/generate scaffold Offer business:references offerType:has_one
start_date:datetime

./script/generate scaffold OfferType image:has_one name:string
description:text

(I'm on Ruby 1.8.7 and Rails 2.3.8.)

Thanks!
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to