class FormObj::Form

Attributes

errors[R]
persisted[W]

Public Class Methods

array_class() click to toggle source
# File lib/form_obj/form.rb, line 18
def array_class
  Array
end
attribute_class() click to toggle source
# File lib/form_obj/form.rb, line 26
def attribute_class
  Attribute
end
model_name() click to toggle source
Calls superclass method
# File lib/form_obj/form.rb, line 30
def model_name
  @model_name || super
end
nested_class() click to toggle source
# File lib/form_obj/form.rb, line 22
def nested_class
  ::FormObj::Form
end
new(*args) click to toggle source
Calls superclass method FormObj::Struct::new
# File lib/form_obj/form.rb, line 38
def initialize(*args)
  @errors = ActiveModel::Errors.new(self)
  @persisted = false
  super
end

Public Instance Methods

mark_as_persisted() click to toggle source
# File lib/form_obj/form.rb, line 48
def mark_as_persisted
  self.persisted = true
  self.class._attributes.each { |attr|
    read_attribute(attr).mark_as_persisted if attr.subform?
  }
  self
end
mark_for_destruction() click to toggle source
# File lib/form_obj/form.rb, line 56
def mark_for_destruction
  @marked_for_destruction = true
  self.class._attributes.each { |attr|
    read_attribute(attr).mark_for_destruction if attr.subform?
  }
  self
end
marked_for_destruction?() click to toggle source
# File lib/form_obj/form.rb, line 64
def marked_for_destruction?
  @marked_for_destruction ||= false
end
persisted?() click to toggle source
# File lib/form_obj/form.rb, line 44
def persisted?
  @persisted
end
update_attributes(attrs, raise_if_not_found: false) click to toggle source
Calls superclass method FormObj::Struct#update_attributes
# File lib/form_obj/form.rb, line 68
def update_attributes(attrs, raise_if_not_found: false)
  super
end

Private Instance Methods

inner_inspect() click to toggle source
# File lib/form_obj/form.rb, line 74
def inner_inspect
  "#{super}#{marked_for_destruction? ? ' marked_for_destruction' : ''}"
end