class Object

Mixin a reflection method that returns self. Useful for generating form fields for primitive objects. It must be mixed in Object because the class for the type :boolean is Object.

Public Instance Methods

reflect_value() click to toggle source
# File lib/big_record/action_view_extensions.rb, line 9
def reflect_value
  self
end
validate_embeddeds() click to toggle source
# File lib/big_record.rb, line 99
def validate_embeddeds
  attributes.each do |k, v|
    if v.kind_of?(BigRecord::Embedded)
      errors.add(k, "is invalid: @errors=#{v.errors.full_messages.inspect}") unless v.valid?
    elsif v.is_a?(Array) and v.first.kind_of?(BigRecord::Embedded)
      v.each_with_index do |item, i|
        next if item.blank?
        unless item.valid?
          errors.add(k, "is invalid. The item ##{i} in the collection has the following errors: @errors=#{item.errors.full_messages.inspect}")
        end
      end
    end
  end
end