Class: Tramway::Core::ExtendedApplicationForm

Inherits:
ApplicationForm
  • Object
show all
Defined in:
app/forms/tramway/core/extended_application_form.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationForm

association, associations, #attributes, #build_errors, #delegating, enumerized_attributes, #form_properties, #form_properties_additional, full_class_name_association, full_class_name_associations, model_class, model_class=, #model_name, #properties, reflect_on_association, #submit, validates, validation_group_class

Constructor Details

#initialize(model) ⇒ ExtendedApplicationForm

Returns a new instance of ExtendedApplicationForm.



12
13
14
15
16
17
18
19
20
21
22
# File 'app/forms/tramway/core/extended_application_form.rb', line 12

def initialize(model)
  @@extendable_properties.each do |prop|
    next if model.respond_to? prop

    model.class.define_method prop do
    end
    model.class.define_method "#{prop}=" do |value|
    end
  end
  super
end

Class Method Details

.properties(*args) ⇒ Object



5
6
7
8
9
# File 'app/forms/tramway/core/extended_application_form.rb', line 5

def properties(*args)
  @@extendable_properties ||= []
  @@extendable_properties += args
  super(*args)
end