Sha256: 8df7209ab9d4bb3168f0fc3655c56dc72d878b028bdf3d4167c83d2722f72973
Contents?: true
Size: 698 Bytes
Versions: 10
Compression:
Stored size: 698 Bytes
Contents
class Tramway::Core::ExtendableForm class << self def new(name, *more_properties) if Object.const_defined? name name.constantize else Object.const_set(name, Class.new(::Tramway::Core::ApplicationForm) do define_method 'submit' do |params| model.values ||= {} model.values = params.permit!.to_h.reduce({}) do |hash, pair| hash.merge! pair[0] => pair[1] end super params end more_properties.each do |property| define_method property do model.values[property] if model.values end end end) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems