Saurabh Peshkar wrote: > Then try this, > > in users_controllers.rb > > def create > @user = User.new(params[:user]) > @club = @user.build_club(params[:club]) > > if @user.valid? > @user.save > end > > end > > Note: it is not required to specify @club.save because '.build' will > automatically do that for you. > > in model/user.rb > validates_associated :club > > Saurabh
but user_id is foreign key in club table..so will it ok to write validates_associated :club in user model? -- 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 -~----------~----~----~----~------~----~------~--~---

