class DuckRecord::Reflection::AbstractReflection
Holds all the methods that are shared between MacroReflection
and ThroughReflection.
AbstractReflection MacroReflection AggregateReflection AssociationReflection HasManyReflection HasOneReflection BelongsToReflection HasAndBelongsToManyReflection ThroughReflection PolymorphicReflection RuntimeReflection
Public Instance Methods
alias_candidate(name)
click to toggle source
# File lib/duck_record/reflection.rb, line 142 def alias_candidate(name) "#{plural_name}_#{name}" end
build_association(attributes, &block)
click to toggle source
Returns a new, unsaved instance of the associated class. attributes
will be passed to the class's constructor.
# File lib/duck_record/reflection.rb, line 126 def build_association(attributes, &block) klass.new(attributes, &block) end
check_validity!()
click to toggle source
# File lib/duck_record/reflection.rb, line 138 def check_validity! true end
class_name()
click to toggle source
Returns the class name for the macro.
composed_of :balance, class_name: 'Money'
returns 'Money'
has_many :clients
returns 'Client'
# File lib/duck_record/reflection.rb, line 134 def class_name @class_name ||= (options[:class_name] || derive_class_name).to_s end