Class: DouguiUsers::UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dougui_users/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#load_user_using_perishable_token

Instance Method Details

#createObject

POST /users POST /users.xml



19
20
21
22
23
24
25
26
27
# File 'app/controllers/dougui_users/users_controller.rb', line 19

def create
  @user = User.new(params[:user])
  if @user.save
    DouguiUsers::UserMailer.activation(@user).deliver
    redirect_to(, :notice => t("successfully_created", :scope => 'users.controller'))
  else
    render :action => "new"
  end
end

#destroyObject

DELETE /users/1 DELETE /users/1.xml



44
45
46
47
48
# File 'app/controllers/dougui_users/users_controller.rb', line 44

def destroy
  @user = User.find(params[:id])
  @user.destroy
  redirect_to(root_path, :notice => t("successfully_destroyed", :scope => 'users.controller'))
end

#editObject

GET /users/1/edit



13
14
15
# File 'app/controllers/dougui_users/users_controller.rb', line 13

def edit
  @user = User.find(params[:id])
end

#newObject

GET /users/new GET /users/new.xml



8
9
10
# File 'app/controllers/dougui_users/users_controller.rb', line 8

def new
  @user = User.new
end

#updateObject

PUT /users/1 PUT /users/1.xml



31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/dougui_users/users_controller.rb', line 31

def update
  @user = User.find(params[:id])

  
  if @user.update_attributes(params[:user])
    redirect_to(root_path, :notice => t("successfully_updated", :scope => 'users.controller'))
  else
    render :action => "edit"
  end
end