Module: Tramway::Core::ApplicationForms::ConstantObjectActions

Included in:
Tramway::Core::ApplicationForm
Defined in:
app/forms/tramway/core/application_forms/constant_object_actions.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



10
11
12
13
14
15
16
17
18
19
# File 'app/forms/tramway/core/application_forms/constant_object_actions.rb', line 10

def attributes
  properties.reduce({}) do |hash, property|
    value = if model.respond_to? :values
              model.values[property.first.to_s]
            else
              model.send(property.first.to_s)
            end
    hash.merge! property.first => value
  end
end

#build_errorsObject



8
# File 'app/forms/tramway/core/application_forms/constant_object_actions.rb', line 8

def build_errors; end

#delegating(object) ⇒ Object



4
5
6
# File 'app/forms/tramway/core/application_forms/constant_object_actions.rb', line 4

def delegating(object)
  %i[to_key errors].each { |method| self.class.send(:define_method, method) { object.send method } }
end