Class: Pulitzer::CreatePostTag
- Inherits:
-
Object
- Object
- Pulitzer::CreatePostTag
- Defined in:
- app/interactions/pulitzer/create_post_tag.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params) ⇒ CreatePostTag
constructor
A new instance of CreatePostTag.
- #post_tag_params ⇒ Object
Constructor Details
#initialize(params) ⇒ CreatePostTag
Returns a new instance of CreatePostTag.
3 4 5 |
# File 'app/interactions/pulitzer/create_post_tag.rb', line 3 def initialize(params) @request_params = params end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/interactions/pulitzer/create_post_tag.rb', line 7 def call label_id = post_tag_params[:label_id] unless (Integer(label_id) rescue false) tag = Pulitzer::Tag.where(name: label_id).first_or_create @request_params[:post_tag][:label_id] = tag.id end Pulitzer::PostTag.create post_tag_params end |
#post_tag_params ⇒ Object
16 17 18 |
# File 'app/interactions/pulitzer/create_post_tag.rb', line 16 def post_tag_params @request_params[:post_tag].permit! end |