Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserprofilesController < ApplicationController
- def show
- @userprofile = current_user.userprofile.find(params[:id])
- end
- def new
- @userprofile = current_user.build_userprofile
- end
- def create
- @userprofile = current_user.build_userprofile(params[:userprofile])
- if @userprofile.save
- notice = "Successfully set your profile."
- redirect_to welcome_url
- else
- render :new
- end
- end
- def edit
- @userprofile = current_user.userprofile.find(params[:id])
- end
- def update
- @userprofile = current_user.userprofile.find(params[:id])
- if @userprofile.update_attributes(params[:userprofile])
- notice = "Successfully updated your profile."
- redirect_to @userprofile
- else
- render :edit
- end
- end
- def destroy
- @userprofile = current_user.userprofile.find(params[:id])
- @userprofile.destroy
- notice = "Successfully destroyed user profile."
- redirect_to root_url
- end
- end
Add Comment
Please, Sign In to add comment