Class: UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/authlogic/complete/templates/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
# File 'lib/generators/authlogic/complete/templates/users_controller.rb', line 10

def create
  @user = User.new(params[:user])
  if @user.save
    flash[:notice] = "Account registered!"
    redirect_back_or_default 
  else
    render :action => :new
  end
end

#editObject



24
25
26
# File 'lib/generators/authlogic/complete/templates/users_controller.rb', line 24

def edit
  @user = current_user
end

#newObject



6
7
8
# File 'lib/generators/authlogic/complete/templates/users_controller.rb', line 6

def new
  @user = User.new
end

#showObject



20
21
22
# File 'lib/generators/authlogic/complete/templates/users_controller.rb', line 20

def show
  @user = current_user
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'lib/generators/authlogic/complete/templates/users_controller.rb', line 28

def update
  @user = @current_user # makes our views "cleaner" and more consistent
  if @user.update_attributes(params[:user])
    flash[:notice] = "Account updated!"
    redirect_to 
  else
    render :action => :edit
  end
end