Class: Form

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pageObject

Returns the value of attribute page.



3
4
5
# File 'app/models/form.rb', line 3

def page
  @page
end

Instance Method Details

#call_extension(name, config) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/form.rb', line 13

def call_extension(name,config)
  result = {}
  # Create a class from the config extension
  extension = config[:extension]
  if extension.present?
    klass     = "Form#{extension.to_s.pluralize.classify}".constantize
    # .pluralize.classify means singulars like business and address are converted correctly
    # Create a new instance of that extension
    klass = (klass).new(self, self.page, config) 

    # Result of the extension create method gets merged
    result = klass.create
  end
end