Hi All,

I have 2 tables
1] user_infos    &
2] users

class UserInfo
has_one :user
validates_presence_of :city

class User
belongs_to :user_info
validates_presence_of :first_name

i write following code in my create method.

 @user_info = UserInfo.new(params[:user_info])
@us...@user_info.build_user(:first_name=>'')

if @user_info.save

else

end

now what i want is to create a object that save data in two table at a
time and if my first name and city is blank it should throw an error
that
user info is not saved because of two errors
1]City can't be blank.
2]Firts name can't be blank.


Regards,

Salil Gaikwad
-- 
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 [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