Class: Drudgery::Loaders::ActiveRecordLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/drudgery/loaders/active_record_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ ActiveRecordLoader

Returns a new instance of ActiveRecordLoader.



6
7
8
9
# File 'lib/drudgery/loaders/active_record_loader.rb', line 6

def initialize(model)
  @model = model
  @name = "active_record:#{@model.name}"
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/drudgery/loaders/active_record_loader.rb', line 4

def name
  @name
end

Instance Method Details

#load(records) ⇒ Object



11
12
13
14
15
# File 'lib/drudgery/loaders/active_record_loader.rb', line 11

def load(records)
  records.each do |record|
    @model.new(record).save(:validate => false)
  end
end