Class: Tienda::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Tienda::UsersController
- Defined in:
- app/controllers/tienda/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
28 29 |
# File 'app/controllers/tienda/users_controller.rb', line 28 def edit end |
#index ⇒ Object
11 12 13 |
# File 'app/controllers/tienda/users_controller.rb', line 11 def index @users = Tienda::User.all end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/tienda/users_controller.rb', line 15 def new @user = Tienda::User.new end |
#update ⇒ Object
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 |