First, I don't really understand the logic to do that. But, OK, it's up to you to define it. If you have the attribute 'first_name defined both in the two models, you should do something like this:
model_name1 = Name1.create(:first_name=>'toto') model_name2 = Name2.new model_name2.first_name = model_name1.first_name model_name2.save! model_name1.model_name2 = model_name2 See more details on Ruby on Rails guides here: http://guides.rubyonrails.org/ On Jun 2, 8:11 pm, 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) > > please help. > > thanks -- 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.

