Class: Comable::Admin::StockLocationsController
Instance Method Summary
collapse
#current_ability, #respond_to_export_with
Instance Method Details
#create ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 30
def create
if @stock_location.save
redirect_to comable.admin_stock_location_path(@stock_location), notice: Comable.t('successful')
else
flash.now[:alert] = Comable.t('failure')
render :new
end
end
|
#destroy ⇒ Object
51
52
53
54
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 51
def destroy
@stock_location.destroy
redirect_to comable.admin_stock_locations_path, notice: Comable.t('successful')
end
|
#edit ⇒ Object
39
40
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 39
def edit
end
|
#index ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 12
def index
@q = Comable::StockLocation.ransack(params[:q])
@stock_locations = @q.result.page(params[:page]).accessible_by(current_ability)
respond_to do |format|
format.html
format.json { render json: @stock_locations }
end
end
|
#new ⇒ Object
26
27
28
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 26
def new
@stock_location.build_address unless @stock_location.address
end
|
#show ⇒ Object
22
23
24
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 22
def show
render :edit
end
|
#update ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'app/controllers/comable/admin/stock_locations_controller.rb', line 42
def update
if @stock_location.update_attributes(stock_location_params)
redirect_to comable.admin_stock_location_path(@stock_location), notice: Comable.t('successful')
else
flash.now[:alert] = Comable.t('failure')
render :edit
end
end
|