Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # PUT /users/1
- def update
- @user = User.find(params[:id])
- if @user.update_attributes(params[:user])
- if params[:profile][:available] == 1 #available is a checkbox that stores a simple flag in the database.
- @user.create_profile(params[:profile])
- end
- else
- #some warnings and errors
- end
- end
- Profile.new(:user_id => @user.id)
- Profile.create(:user_id => @user.id)
- profile = @user.build_profile
- profile.save
Add Comment
Please, Sign In to add comment