Sha256: e9086bdfc9ce0f7652b613a147c850b1de836b47b37231b37a0edc022b929487
Contents?: true
Size: 538 Bytes
Versions: 12
Compression:
Stored size: 538 Bytes
Contents
class Pulitzer::CreatePostTag attr_accessor :post, :request_params def initialize(post, params) self.post = post self.request_params = params end def call label_id = request_params[:post_tag][: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 post.preview_version.post_tags.create post_tag_params end def post_tag_params request_params[:post_tag].permit! end end
Version data entries
12 entries across 12 versions & 1 rubygems