Class: FlyAdmin::CategoriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FlyAdmin::CategoriesController
- Defined in:
- app/controllers/fly_admin/categories_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #seasons ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 11 def create if @category.save flash[:notice] = "Сериал успешно создан " redirect_to categories_path else render 'new' end end |
#destroy ⇒ Object
37 38 39 40 41 42 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 37 def destroy @category = Category.find(params[:id]) @category.destroy! flash[:notice] = "Сериал успешно удален" redirect_to categories_path end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 24 def edit @category = Category.find(params[:id]) end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 7 def index @categories = Category.all end |
#new ⇒ Object
20 21 22 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 20 def new @category = Category.new end |
#seasons ⇒ Object
44 45 46 47 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 44 def seasons @category = Category.find(params[:category_id]) @seasons = @category.seasons.each {|s| s.json_title = JSON.parse(s.title)["ru"]} end |
#update ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/controllers/fly_admin/categories_controller.rb', line 28 def update if @category.update_attributes(category_params) flash[:notice] = "Сериал обновлен" redirect_to categories_path else render action: "edit" end end |