Class: Blogr::TagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Blogr::TagsController
- Defined in:
- app/controllers/blogr/tags_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/blogr/tags_controller.rb', line 26 def create @tag = Tag.new(tag_params) if @tag.save redirect_to , notice: 'Tag was successfully created.' else render action: 'new' end end |
#destroy ⇒ Object
44 45 46 47 |
# File 'app/controllers/blogr/tags_controller.rb', line 44 def destroy @tag.destroy redirect_to categories_url, notice: 'Tag was successfully destroyed.' end |
#edit ⇒ Object
22 23 24 |
# File 'app/controllers/blogr/tags_controller.rb', line 22 def edit @title = "Editing '#{@tag.name}'" end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/blogr/tags_controller.rb', line 8 def index @tags = Tag.all @title = "Tags" end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/blogr/tags_controller.rb', line 17 def new @tag = Tag.new @title = "New Tag" end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/blogr/tags_controller.rb', line 13 def show @title = @tag.name end |
#update ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/blogr/tags_controller.rb', line 36 def update if @tag.update(tag_params) redirect_to , notice: 'Tag was successfully updated.' else render action: 'edit' end end |