Preksha Patel wrote:
> Preksha Patel wrote:
>> Saurabh Peshkar wrote:
>>> Have you written
>>> 
>>> in user.rb
>>> 
>>>  has_one :club
>>> 
>>> Saurabh
>> 
>> yes because there is one-to-one relationship between this two model and 
>> user_id is foreign key in club table..
> 
> sorry i 4got  to add this line..

now i wrote this code in users_controller:

@user = User.new(params[:user])
    @club = @user.build_club(params[:club])

 if @user.valid?
  @user.save
 end

and in user model this code:

has_one :club
validates_associated :club

then also validations didnt called..
-- 
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