Class: Admin::Skin::RecipesController

Inherits:
LoyalAdmin::ApplicationController
  • Object
show all
Defined in:
app/controllers/loyal_core/admin/skin/recipes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 16

def create
  @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.new(params[:loyal_core_skin_recipe])

  @loyal_core_skin_recipe.created_by = current_user.id
  @loyal_core_skin_recipe.created_ip = request.remote_ip

  if @loyal_core_skin_recipe.save
    redirect_to loyal_core_app.admin_skin_recipe_url(:id => @loyal_core_skin_recipe.id)
  else
    render :new
  end
end

#destroyObject



43
44
45
46
47
48
49
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 43

def destroy
  @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]

  @loyal_core_skin_recipe.destroy

  redirect_to params[:return_to] || loyal_core_app.admin_skin_recipes_url
end

#editObject



29
30
31
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 29

def edit
  @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]
end

#indexObject



4
5
6
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 4

def index
  @loyal_core_skin_recipes = ::LoyalCore::Skin::Recipe.page(params[:page])
end

#newObject



12
13
14
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 12

def new
  @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.new
end

#showObject



8
9
10
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 8

def show
  @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]
end

#updateObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/loyal_core/admin/skin/recipes_controller.rb', line 33

def update
  @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]

  if @loyal_core_skin_recipe.update_attributes(params[:loyal_core_skin_recipe])
    redirect_to loyal_core_app.admin_skin_recipe_url(:id => @loyal_core_skin_recipe.id)
  else
    render :edit
  end
end