Sha256: 73837e64899ab27771dfdc27cb9a2fd7d8ff7fb2a0529e6d590eb1293a2f65d2

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

# frozen_string_literal: true

require "active_support"

module Yamls
  module Support
    module Parameters
      extend ActiveSupport::Concern

      included do
        before_action :define_params_method
      end

      protected

      def yamls
        Yamls::Parameters.new(
          params,
          model: controller_name.singularize,
          action: action_name,
        ).permit
      end

      def define_params_method
        method_name = "#{controller_name.singularize}_#{action_name}_params"

        define_singleton_method(method_name) { yamls }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yamls-0.2.2 lib/yamls/support/parameters.rb