Class: Smithy::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/smithy/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/smithy/users_controller.rb', line 16

def create
  @user = User.new(filtered_params)
  @user.save
  flash.notice = "The user was created" if @user.persisted?
  respond_with @user do |format|
    format.html { redirect_to [:edit, @user] }
  end
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/smithy/users_controller.rb', line 38

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

#editObject



25
26
27
28
# File 'app/controllers/smithy/users_controller.rb', line 25

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

#indexObject



7
8
9
# File 'app/controllers/smithy/users_controller.rb', line 7

def index
  respond_with @users
end

#newObject



11
12
13
14
# File 'app/controllers/smithy/users_controller.rb', line 11

def new
  @user = User.new(filtered_params)
  respond_with @user
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/smithy/users_controller.rb', line 30

def update
  @user = User.find(params[:id])
  flash.notice = "The user was saved" if @user.update_attributes(filtered_params)
  respond_with @user do |format|
    format.html { redirect_to [:edit, @user] }
  end
end