Class: Tramway::Core::ExtendedApplicationForm

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

Instance Attribute Summary

Attributes inherited from ApplicationForm

#submit_message

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationForm

add_polymorphic_association, association, #associations, enumerized_attributes, full_class_name_association, full_class_name_associations, model_class, model_class=, #model_name, property, reflect_on_association, validates

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