acts_as_importable 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_importable}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jagdeep Singh"]
12
- s.date = %q{2011-01-17}
12
+ s.date = %q{2011-01-21}
13
13
  s.description = %q{Use this gem to add import/export to .csv functionality to your activerecord models}
14
14
  s.email = %q{jagdeepkh@gmail.com}
15
15
  s.extra_rdoc_files = [
data/lib/import_export.rb CHANGED
@@ -36,7 +36,7 @@ module ModelMethods
36
36
 
37
37
  self.import_fields.each_with_index do |field_name, field_index|
38
38
  if field_name.include?('.')
39
- assign_association(element, field_name, field_index, scope_object, data_row)
39
+ assign_association(element, field_name, field_index, context, data_row)
40
40
  else
41
41
  element.send "#{field_name}=", data_row[field_index]
42
42
  end
@@ -116,14 +116,15 @@ module ModelMethods
116
116
 
117
117
  protected
118
118
 
119
- def assign_association(element, field_name, field_index, scope_object, data_row)
119
+ def assign_association(element, field_name, field_index, context, data_row)
120
+ scope_object = context[:scoped]
120
121
  create_record = field_name.include?('!')
121
122
  association_name, association_attribute = field_name.gsub(/!/,'').split('.')
122
123
  assign_association_method = "assign_#{association_name}"
123
124
  association_fk = "#{association_name}_id"
124
125
 
125
126
  if element.respond_to?(assign_association_method)
126
- element.send assign_association_method, data_row
127
+ element.send assign_association_method, data_row, context
127
128
  elsif element.respond_to?(association_fk)
128
129
  association_class = association_name.classify.constantize
129
130
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_importable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jagdeep Singh
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-17 00:00:00 +05:30
18
+ date: 2011-01-21 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency