has_moderated 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,15 +41,16 @@ module HasModerated
41
41
  # PARAM = Hash (create)
42
42
  else
43
43
  arec = m.new
44
- attrs.each_pair do |key, val|
45
- arec.send(key.to_s+"=", val) unless key.to_s == 'id'
46
- end
44
+ # set foreign key first, may be required sometimes
47
45
  fk = if assoc_details.respond_to?(:foreign_key)
48
46
  assoc_details.foreign_key
49
47
  else # Rails < v3.1
50
48
  assoc_details.primary_key_name
51
49
  end
52
50
  arec.send(fk.to_s+"=", rec.id) # set association to the newly created record
51
+ attrs.each_pair do |key, val|
52
+ arec.send(key.to_s+"=", val) unless key.to_s == 'id'
53
+ end
53
54
  # disable moderation for associated model (if moderated)
54
55
  arec.has_moderated_updating = true if arec.respond_to?("has_moderated_updating=")
55
56
  arec.save(:validate => false) # don't run validations
@@ -1,3 +1,3 @@
1
1
  module HasModerated
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_moderated
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 13
10
- version: 0.0.13
9
+ - 14
10
+ version: 0.0.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Berdajs