Class: Admin::Posts::TagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ApplicationController
- Admin::Posts::TagsController
- Defined in:
- lib/ecrire/app/controllers/admin/posts/tags_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods inherited from ApplicationController
#current_user, #signed_in?, #url
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ecrire/app/controllers/admin/posts/tags_controller.rb', line 13 def create @tag = Tag.search_by_name(tag_params[:name]).first if @tag.nil? @tag = Tag.create(tag_params) end if @post..include? @tag @post. = @post..where.not(id: @tag.id) else @post. << @tag end @post.save! end |