Class: Pulitzer::TagsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Pulitzer::TagsController
- Defined in:
- app/controllers/pulitzer/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
27 28 29 30 31 32 33 34 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 27 def create @tag = Tag.new(tag_params) if @tag.save render partial: 'show_wrapper', locals: { tag: @tag } else render partial: new_template(@tag), locals: { tag: @tag }, status: 409 end end |
#destroy ⇒ Object
44 45 46 47 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 44 def destroy @tag.destroy head :ok end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 18 def edit render partial: 'form', locals: { tag: @tag } end |
#index ⇒ Object
7 8 9 10 11 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 7 def index @root_tags = Tag.root @flat_tags = Tag.flat render partial: 'index' end |
#new ⇒ Object
13 14 15 16 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 13 def new @tag = Tag.new(tag_params) render partial: new_template(@tag) end |
#show ⇒ Object
22 23 24 25 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 22 def show @tag = Tag.find(params[:id]) render partial: 'show', locals: { tag: @tag } end |
#update ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/pulitzer/tags_controller.rb', line 36 def update if @tag.update_attributes(tag_params) render partial: 'show', locals: { tag: @tag } else render partial: 'form', locals: { tag: @tag }, status: 409 end end |