Class: Pulitzer::PartialTagsController::CreatePartialTag
- Inherits:
-
Object
- Object
- Pulitzer::PartialTagsController::CreatePartialTag
- Defined in:
- app/interactions/pulitzer/partial_tags_controller/create_partial_tag.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params) ⇒ CreatePartialTag
constructor
A new instance of CreatePartialTag.
- #partial_tag_params ⇒ Object
Constructor Details
#initialize(params) ⇒ CreatePartialTag
Returns a new instance of CreatePartialTag.
3 4 5 |
# File 'app/interactions/pulitzer/partial_tags_controller/create_partial_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/partial_tags_controller/create_partial_tag.rb', line 7 def call label_id = partial_tag_params[:label_id] unless (Integer(label_id) rescue false) tag = Pulitzer::Tag.where(name: label_id).first_or_create @request_params[:partial_tag][:label_id] = tag.id end Pulitzer::PartialTag.create partial_tag_params end |
#partial_tag_params ⇒ Object
16 17 18 |
# File 'app/interactions/pulitzer/partial_tags_controller/create_partial_tag.rb', line 16 def partial_tag_params @request_params[:partial_tag].permit! end |