Skip to content

Instantly share code, notes, and snippets.

@jraczak
Created March 7, 2012 18:09
Show Gist options
  • Save jraczak/1994740 to your computer and use it in GitHub Desktop.
Save jraczak/1994740 to your computer and use it in GitHub Desktop.
controller source
class UsersController < ApplicationController
before_filter :authenticate, :only => [:edit, :update]
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to root_path, :notice => "User has been successfully registered."
else
render :action => "new"
end
end
def edit
@user = current_user
end
def update
@user = current_user
if @user.update_attributes(params[:user])
redirect_to articles_path, :notice => "User information has been successfully updated"
else
render :action => "edit"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment