Class: TmLyn::CategoriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- TmLyn::CategoriesController
- Defined in:
- app/controllers/tm_lyn/categories_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/tm_lyn/categories_controller.rb', line 9 def create @cat = Category.new(cat_params) if @cat.save redirect_to categories_path, notice:"Category created" else render :new, status: :unprocessable_entity end end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/tm_lyn/categories_controller.rb', line 17 def edit @cat = Category.find(params[:id]) end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/tm_lyn/categories_controller.rb', line 3 def index @cats = Category.all end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/tm_lyn/categories_controller.rb', line 6 def new @cat = Category.new end |
#update ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/tm_lyn/categories_controller.rb', line 20 def update @cat = Category.find(params[:id]) if @cat.update(cat_params) redirect_to categories_path, notice:"Category updated successfully" else render :edit end end |