Class: Comable::Admin::StoreController

Inherits:
ApplicationController show all
Defined in:
app/controllers/comable/admin/store_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /admin/store



23
24
25
26
27
28
29
30
31
# File 'app/controllers/comable/admin/store_controller.rb', line 23

def create
  @store = Comable::Store.new(store_params)

  if @store.save
    redirect_to comable.admin_store_url(@store), notice: 'Store was successfully created.'
  else
    render :new
  end
end

#editObject

GET /admin/store/edit



18
19
20
# File 'app/controllers/comable/admin/store_controller.rb', line 18

def edit
  @store = Comable::Store.first
end

#newObject

GET /admin/store/new



13
14
15
# File 'app/controllers/comable/admin/store_controller.rb', line 13

def new
  @store = Comable::Store.new
end

#showObject

GET /admin/store



7
8
9
10
# File 'app/controllers/comable/admin/store_controller.rb', line 7

def show
  @store = Comable::Store.first
  return redirect_to action: :new unless @store
end

#updateObject

PATCH/PUT /admin/store



34
35
36
37
38
39
40
41
# File 'app/controllers/comable/admin/store_controller.rb', line 34

def update
  @store = Comable::Store.first
  if @store.update(store_params)
    redirect_to comable.admin_store_url(@store), notice: 'Store was successfully updated.'
  else
    render :edit
  end
end