Module: Mover::Base::Record::ClassMethods

Defined in:
lib/mover/record.rb

Instance Method Summary collapse

Instance Method Details

#move_from(type, conditions) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mover/record.rb', line 6

def move_from(type, conditions)
  klass = movable_class(type)
  if klass
    if klass.column_names.include?('move_id')
      klass.find_each(:conditions => conditions) do |record|
        record.move_from
      end
    else
      execute_move(klass, self, conditions)
    end
  end
end

#move_to(type, conditions) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/mover/record.rb', line 19

def move_to(type, conditions)
  if movable_class(type).column_names.include?('move_id')
    self.find_each(:conditions => conditions) do |record|
      record.move_to(type)
    end
  else
    execute_move(self, movable_class(type), conditions)
  end
end