On 2 June 2011 19:11, joanne <[email protected]> wrote:
> Hi all,
>
> I am new in Rials, I have problem to assign the first name from (model
> - name1) to first-name (model name2)
>
> cuz when i create a name in table name1, i want it appears in table
> name2
>
> and my model relationship is:
>
> model name1  - ( has_one :name2)
> model name2 = (belongs_to :name)

If you mean that you have two tables, both with a 'name' column and
you want the same data in both columns then I advise against this.  It
is generally a bad idea to have the same data in two tables in the
database, you have to be very careful to keep them the same when the
name is edited for example.  Also there is no need since you have
defined a relationship between the tables.  So if you have a name1
record in @name1 and the name column is in table name2 then you can
say @name1.name2.name to get the name.

Colin

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to