Sha256: 724097e10079ff62a105189808abaedc7bea004fd96817f5c1aeddd1583988e4
Contents?: true
Size: 473 Bytes
Versions: 10
Compression:
Stored size: 473 Bytes
Contents
# frozen_string_literal: true require 'json' require 'ostruct' module Params module FormForObjectHelper def form_for_object_from_param(param, defaults = {}) form_for_params = current_params.fetch(param, {}) form_for_requirements = { model_name: { param_key: param } } form_for_hash = defaults.merge(form_for_params).merge(form_for_requirements) JSON.parse(form_for_hash.to_json, object_class: OpenStruct) end end end
Version data entries
10 entries across 10 versions & 1 rubygems