Hi Chris, Use an after_create callback in the User model to create the associated Wishlist record.
HTH, Bill On Feb 8, 2012 3:25 PM, "Christopher Jones" <li...@ruby-forum.com> wrote: > Hi all I wondering how I would go about generating multiple features on > user creation. I want every user who signs up to have a wishlist > automatically which is a separate to the actual users (different > model/view/controller etc.) > > On user create I want it to create a user as well as create a wishlist. > The wishlist will be blank but I just want the feature to show on their > profile so that they can edit. Currently the user has to click on a > button to set it up. > > Here is my current user create method. I want to add a line to create > the wishlist alongside. Any help will be appreciated. > > def create > @user = User.new(params[:user]) > respond_to do |format| > if @user.save > UserMailer.registration_confirmation(@user).deliver > session[:user_id] = @user.id > format.html { redirect_to root_url, :notice => "User was > successfully created." } > > else > format.html { render :action => "new" } > format.xml { render :xml => @user.errors, :status => > :unprocessable_entity } > end > end > end > > -- > 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 rubyonrails-talk@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.