module Millstone::ActiveRecord::Associations::ClassMethods
Public Instance Methods
belongs_to_with_millstone(association_id, options = {})
click to toggle source
# File lib/millstone/active_record/associations.rb, line 29 def belongs_to_with_millstone(association_id, options = {}) with_deleted = options.delete :with_deleted belongs_to_without_millstone(association_id, options).tap do if with_deleted reflection = reflect_on_association(association_id) if reflection.options[:polymorphic] association_accessor_methods(reflection, Millstone::ActiveRecord::Associations::BelongsToPolymorphicAssociation) else association_accessor_methods(reflection, Millstone::ActiveRecord::Associations::BelongsToAssociation) association_constructor_method(:build, reflection, Millstone::ActiveRecord::Associations::BelongsToAssociation) association_constructor_method(:create, reflection, Millstone::ActiveRecord::Associations::BelongsToAssociation) end end end end
has_many_with_millstone(association_id, options = {}, &extension)
click to toggle source
# File lib/millstone/active_record/associations.rb, line 18 def has_many_with_millstone(association_id, options = {}, &extension) with_deleted = options.delete :with_deleted has_many_without_millstone(association_id, options, &extension).tap do reflection = reflect_on_association(association_id) if options[:through] and !with_deleted collection_accessor_methods(reflection, Millstone::ActiveRecord::Associations::HasManyThroughWithoutDeletedAssociation) end end end