Sha256: dc14b1d02771c98c05b917743654ca666dae61f8cfd29a2889e0514c02a75d6f

Contents?: true

Size: 453 Bytes

Versions: 4

Compression:

Stored size: 453 Bytes

Contents

# frozen_string_literal: true

module Thredded
  # @api private
  module NewPostParams
    protected

    def new_post_params
      params.fetch(:post, {})
        .permit(:content, :quote_post_id)
        .merge(ip: request.remote_ip).tap do |p|
        quote_id = p.delete(:quote_post_id)
        if quote_id
          post = Post.find(quote_id)
          authorize_reading post
          p[:quote_post] = post
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thredded-0.13.0 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.12.4 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.12.3 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.12.2 app/controllers/concerns/thredded/new_post_params.rb