Class: ClerksController
Instance Method Summary
collapse
#clean_search, #require_admin
#error
#best_euros, #current_basket, #current_basket_or_nil, #current_clerk, #date, #euros, #has_ssl?, #markdown, #new_basket, #paginate, #shipping_method
Instance Method Details
#create ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/clerks_controller.rb', line 26
def create
@clerk = Clerk.create(params_for_model)
if @clerk.save
flash.notice = t(:create_success, :model => "clerk")
redirect_to clerk_path(@clerk)
else
render :edit
end
end
|
#edit ⇒ Object
23
24
|
# File 'app/controllers/clerks_controller.rb', line 23
def edit
end
|
#index ⇒ Object
Uncomment for check abilities with CanCan authorize_resource
9
10
11
12
13
|
# File 'app/controllers/clerks_controller.rb', line 9
def index
@q = Clerk.search params[:q]
@clerk_scope = @q.result(:distinct => true)
@clerks = @clerk_scope.paginate( :page => params[:page],:per_page => 20)
end
|
#new ⇒ Object
18
19
20
21
|
# File 'app/controllers/clerks_controller.rb', line 18
def new
@clerk = Clerk.new
render :edit
end
|
#show ⇒ Object
15
16
|
# File 'app/controllers/clerks_controller.rb', line 15
def show
end
|
#update ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/clerks_controller.rb', line 36
def update
pars = params_for_model
if pars["password"].blank? and pars["password_confirmation"].blank?
pars.delete("password")
pars.delete("password_confirmation")
end
if @clerk.update_attributes(pars)
redirect_to clerk_path(@clerk), :notice => t(:update_success, :model => "clerk")
else
render :action => :edit
end
end
|