Class: Drudgery::Loaders::ActiveRecordLoader
- Inherits:
-
Object
- Object
- Drudgery::Loaders::ActiveRecordLoader
- Defined in:
- lib/drudgery/loaders/active_record_loader.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(model) ⇒ ActiveRecordLoader
constructor
A new instance of ActiveRecordLoader.
- #load(records) ⇒ Object
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
#name ⇒ Object (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 |