class Traits::Association

Attributes

reflection[R]

Public Class Methods

new(active_record, reflection) click to toggle source
# File lib/traits/association.rb, line 33
def initialize(active_record, reflection)
  @from_active_record = active_record
  @reflection         = reflection
end

Public Instance Methods

inspect() click to toggle source
# File lib/traits/association.rb, line 38
def inspect
  "#{from.class_name}##{name}"
end
to_s() click to toggle source
# File lib/traits/association.rb, line 42
def to_s
  name
end
validators() click to toggle source
# File lib/traits/association.rb, line 50
def validators
  from_active_record.validators_on(name)
end
value_from(model) click to toggle source
# File lib/traits/association.rb, line 46
def value_from(model)
  model.send(name)
end