Colin Law wrote in post #1068465:
> On 12 July 2012 17:37, Jean-Sbastien D. <li...@ruby-forum.com> wrote:
>>>
>> CUSTOMER       ORDER
>> first          customer_id
>> last           pay_to
>> ...            ...
>>
>> Correct then in the model i should specify the relation ship correct?
>
> Can you explain the above again, I don't understand what you are
> trying to achieve.  Also it is best to talk first about models and
> relationships, (has_many, belongs_to and so on) then the table
> requirements will follow from that.
>
> So first tell us what the models are and what the relationships are.
>
> Colin

Well i am from MySQL world. I am use to a database has follow

CUSTOMER                     ORDER
customerID                   orderID
firstName                    customerID
lastName                     price
password                     proceededAt
emails

In MySQL you would have has follow: PK customerID, orderID, FK 
order(customerID) to customer(customerID)

In Rails if I understood I create has follow

CUSTOMER                      ORDER
first_name                    price
last_name                     proceed_at
password
emails

Now in models I would have to say

Customer belongs to order
Order has customer

Now my main questions I understand I dont define customer_id and 
order_id in customer and order table because its already assume to have 
an id key when created. But in ORDER model should I define 
customer_id:integer and in model say
ORder customer_id: has customer. To let it know that this field is 
actually a foreign key?

-- 
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-talk@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-US.

Reply via email to