acts_as 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 766bcda0d611baa22b79963cd324f58a217a0d1e
4
- data.tar.gz: b516b6ab0913371eb77ad5ab849d8a20a6fef8c8
3
+ metadata.gz: 15fd1734d96a4851b895c5dee27dee35f60527fc
4
+ data.tar.gz: bf3c25453ba178413ffbe423b9c31a833d454b91
5
5
  SHA512:
6
- metadata.gz: d6885a35166aa95fd8ba7ad177a75cdcb4b9f7b206d95ee3435bb1129c32a91df92235627bee36fd931eb683bcd0e6854e49a17f2bc5a3b323b1249a8c62cf4f
7
- data.tar.gz: c1898259ca401335793e9487112d730782a5d386b717960470acbddacf14d309490ab924446fc997a09df75dad7c36c0d475256acfb5c83af7d02f9b8afcfbf3
6
+ metadata.gz: c3b38d53698a4b135a79869e55f8ffe940b0898fd1e70065870a60f7909cef90377b65111655f13cbeaf7bee2eec0616d3d92e9856d3286001192ff0d2a4e123
7
+ data.tar.gz: c6bbe641bc0b4265ba4100f8976855180d2f9e0503cffa5a3373483c94cf1cb4eafca7911e4be6bd8217dcf19d7c4ee3b9802d4cdf86475d7d4f2ef504b35560
@@ -1,3 +1,3 @@
1
1
  module ActsAs
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
data/lib/acts_as.rb CHANGED
@@ -18,7 +18,9 @@ module ActsAs
18
18
  end
19
19
 
20
20
  def update_column(name, value)
21
- if (association = self.class.acts_as_fields.detect { |k,v| v.include?(name.to_s) }.try(:first)).present?
21
+ if attribute_names.include?(name.to_s)
22
+ super
23
+ elsif (association = self.class.acts_as_fields.detect { |k,v| v.include?(name.to_s) }.try(:first)).present?
22
24
  send(association).update_column name, value
23
25
  else
24
26
  super
@@ -101,23 +103,10 @@ module ActsAs
101
103
  def whitelist_and_delegate_fields(association_class, one_association, prefix, with)
102
104
  association_fields = association_class.columns.map(&:name) - PREFIX - prefix + with
103
105
 
104
- build_prefix_methods(one_association, prefix)
105
-
106
106
  delegate(*(association_fields + association_fields.map { |field| "#{field}=" }), to: one_association)
107
+ delegate(*(prefix + prefix.map { |field| "#{field}=" }), to: one_association, prefix: true)
107
108
 
108
109
  acts_as_fields[one_association] = association_fields + prefix
109
110
  end
110
-
111
- def build_prefix_methods(one_association, prefix)
112
- prefix.each do |field|
113
- define_method("#{one_association}_#{field}") do |*args|
114
- send(one_association).send(field, *args)
115
- end
116
-
117
- define_method("#{one_association}_#{field}=") do |*args|
118
- send(one_association).send("#{field}=", *args)
119
- end
120
- end
121
- end
122
111
  end
123
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hired, Inc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-18 00:00:00.000000000 Z
12
+ date: 2015-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.4.6
124
+ rubygems_version: 2.4.5
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: delegate an entire 1:1 association worth of active record field-related helpers