Sha256: ded89a660c5f7fe63a17333a53f1ca7983af8b09622efb3045c6fb3bed79e043
Contents?: true
Size: 1.12 KB
Versions: 48
Compression:
Stored size: 1.12 KB
Contents
module Para module Component class Form < Para::Component::Resource register :form, self include Para::Component::History configurable_on :model_type has_one :component_resource, class_name: 'Para::ComponentResource', foreign_key: :component_id, autosave: true, dependent: :destroy def resource build_component_resource(resource: model.new) unless component_resource component_resource.resource ||= model.new end def resource=(value) build_component_resource(resource: value) unless component_resource end def default_form_actions [:submit] end def update_with(attributes) # If no model_type is provided in the configuration file, default to # the camelized version of the identifier, allowing to create # form components without setting the :model_type option, # when given a conventional name attributes[:model_type] ||= identifier.to_s.camelize.singularize if identifier attributes[:controller] ||= '/para/admin/form_resources' super end end end end
Version data entries
48 entries across 48 versions & 1 rubygems