Class: Tienda::UsersController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @user = Tienda::User.new(safe_params)
  if @user.save
    redirect_to :users, flash: { notice: t('tienda.users.create_notice') }
  else
    render action: 'new'
  end
end

#destroyObject



39
40
41
42
43
# File 'app/controllers/tienda/users_controller.rb', line 39

def destroy
  fail Tienda::Error, t('tienda.users.self_remove_error') if @user == current_user
  @user.destroy
  redirect_to :users, flash: { notice: t('tienda.users.destroy_notice') }
end

#editObject



28
29
# File 'app/controllers/tienda/users_controller.rb', line 28

def edit
end

#indexObject



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

def index
  @users = Tienda::User.all
end

#newObject



15
16
17
# File 'app/controllers/tienda/users_controller.rb', line 15

def new
  @user = Tienda::User.new
end

#updateObject



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

def update
  if @user.update(safe_params)
    redirect_to [:edit, @user], flash: { notice: t('tienda.users.update_notice') }
  else
    render action: 'edit'
  end
end