Skip to content

Commit b204bea

Browse files
committed
don't use mass assignment operation for creating new records
1 parent 9de5e94 commit b204bea

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
0.1.2 - 2012-11-15
2+
3+
Bug fixes
4+
5+
* don't use mass assignment operation for creating new records
6+
17
0.1.1 - 2012-11-15
28

39
Enhancements

lib/easy/reference_data/refresh.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ def self.refresh(clazz, unique_attribute_symbol, unique_attribute_value, attribu
44
record = clazz.where(unique_attribute_symbol => unique_attribute_value).first
55

66
if record.nil?
7-
record = clazz.new(unique_attribute_symbol => unique_attribute_value)
7+
record = clazz.new
8+
record.send "#{unique_attribute_symbol}=", unique_attribute_value
89
end
910

1011
attributes.each_pair do |key, value|
1112
record.send "#{key}=", value
1213
end
1314

1415
if record.new_record?
15-
puts " creating #{clazz}(#{unique_attribute_value})"
16+
puts "..creating #{clazz}(#{unique_attribute_value})"
1617
elsif record.changed?
17-
puts " updating #{clazz}(#{unique_attribute_value})"
18+
puts "..updating #{clazz}(#{unique_attribute_value})"
1819
end
1920

2021
begin

lib/easy/reference_data/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Easy
22
module ReferenceData
3-
VERSION = "0.1.1"
3+
VERSION = "0.1.2"
44
end
55
end

0 commit comments

Comments
 (0)