acts_as_lookup 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "acts_as_lookup"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Percival"]
@@ -97,10 +97,13 @@ module ActsAsLookupClassMethods
97
97
  acts_as_lookup_options[:values].each do |val|
98
98
  next if @acts_as_lookup_by_id.include?(val[:id])
99
99
 
100
- # allow for attr_accessible protection, assign attributes one-by-one
100
+ # bypass attr_accessible protection, assign attributes one-by-one
101
101
  new_val = self.new
102
102
  val.each_pair do |attr,value|
103
- new_val.send("#{attr.to_s}=".to_sym, value)
103
+ setter = "#{attr.to_s}=".to_sym
104
+ if new_val.respond_to?(setter)
105
+ new_val.send(setter, value)
106
+ end
104
107
  end
105
108
  new_val.save!
106
109
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: