Module: MoveAssociations::ClassMethods

Defined in:
lib/move_associations/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#associations_to_moveObject



9
10
11
12
13
# File 'lib/move_associations/class_methods.rb', line 9

def associations_to_move
  (self.reflect_on_all_associations(:has_many) + self.reflect_on_all_associations(:has_one)).collect do |association|
    association unless association.options.has_key? :through
  end.compact
end

#destroy_all_with_empty_associationsObject



3
4
5
6
7
# File 'lib/move_associations/class_methods.rb', line 3

def destroy_all_with_empty_associations
  all.each do |record|
    record.destroy_if_associations_are_empty
  end
end