module Railjet
  module Form
    extend  ::ActiveSupport::Concern
    include Railjet::Validator

    included do
      const_set(:Error, Class.new(Railjet::FormError))
      
      def initialize(attributes = {})
        super(attributes.to_h)
      end
    end
  end
end

module Railjet
  module Form
    extend  ::ActiveSupport::Concern
    include Railjet::Validator

    included do
      const_set(:Error, Class.new(Railjet::FormError))
      
      def initialize(attributes = {})
        super(attributes.respond_to?(:to_unsafe_h) ? attributes.to_unsafe_h : attributes)
      end
    end
  end
end

Make Railjet::Form work in Rails5 and Rails4
Make Railjet::Form work in Rails5 and Rails4

We want to make it work with `ActionController::Parameters` both in version 4 and 5, but also in non-rails scenario
