Class: LoyalAdmin::LoyalCore::Skin::RecipesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 18

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_admin_app.loyal_core_skin_recipe_url(:id => @loyal_core_skin_recipe.id)
  else
    render :new
  end
end

#destroyObject



45
46
47
48
49
50
51
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 45

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

  @loyal_core_skin_recipe.destroy

  redirect_to params[:return_to] || loyal_admin_app.loyal_core_skin_recipes_url
end

#editObject



31
32
33
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 31

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

#indexObject



6
7
8
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 6

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

#newObject



14
15
16
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 14

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

#showObject



10
11
12
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 10

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

#updateObject



35
36
37
38
39
40
41
42
43
# File 'app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb', line 35

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_admin_app.loyal_core_skin_recipe_url(:id => @loyal_core_skin_recipe.id)
  else
    render :edit
  end
end