Created
March 7, 2012 18:09
-
-
Save jraczak/1994740 to your computer and use it in GitHub Desktop.
controller source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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