Sha256: de4e7780278c14373911014a1363b5ca697700821fc4ec334b2a0ce0db5b7246

Contents?: true

Size: 398 Bytes

Versions: 4

Compression:

Stored size: 398 Bytes

Contents

# frozen_string_literal: true

require 'json'
require 'ostruct'

module Params
  module FormForObjectHelper
    def form_for_object_from_param(param)
      form_for_params = params.fetch(param, {})
      form_for_requirements = { model_name: { param_key: param } }

      JSON.parse(form_for_params.merge(form_for_requirements).to_json,
                 object_class: OpenStruct)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
actionset-0.5.3 lib/action_set/helpers/params/form_for_object_helper.rb
actionset-0.5.2 lib/action_set/helpers/params/form_for_object_helper.rb
actionset-0.5.1 lib/action_set/helpers/params/form_for_object_helper.rb
actionset-0.5.0 lib/action_set/helpers/params/form_for_object_helper.rb