Class: Shoppe::UsersController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

#destroyObject

Raises:



40
41
42
43
44
# File 'app/controllers/shoppe/users_controller.rb', line 40

def destroy
  raise Shoppe::Error, t('shoppe.users.self_remove_error') if @user == current_user
  @user.destroy
  redirect_to :users, :flash => {:notice => t('shoppe.users.destroy_notice') }
end

#editObject



29
30
# File 'app/controllers/shoppe/users_controller.rb', line 29

def edit
end

#indexObject



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

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

#newObject



16
17
18
# File 'app/controllers/shoppe/users_controller.rb', line 16

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

#updateObject



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

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