Created
March 7, 2012 23:34
-
-
Save jraczak/1997257 to your computer and use it in GitHub Desktop.
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 index | |
@users = User.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render :json => @users } | |
end | |
end | |
def show | |
@user = User.find(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render :json => @user } | |
end | |
end | |
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 | |
def full_name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment