jcnetdev-acts_as_applyable 0.3 → 0.4

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.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'acts_as_applyable'
3
- s.version = '0.3'
4
- s.date = '2008-09-18'
3
+ s.version = '0.4'
4
+ s.date = '2008-09-19'
5
5
 
6
6
  s.summary = "A better (and safer) way of applying model attributes from your controller params"
7
7
  s.description = "Rid yourself of attr_accessible and attr_protected. This plugin allows you to stop using mass assignment, and gives you a more flexible way of interacting with your controller params."
@@ -10,7 +10,8 @@ module ActiveRecord
10
10
 
11
11
  module ClassMethods
12
12
  def acts_as_applyable(*accessible_attributes)
13
- @@accessible_attributes = accessible_attributes
13
+ cattr_accessor :accessible_attribute_list
14
+ self.accessible_attribute_list = accessible_attributes
14
15
  end
15
16
  end
16
17
 
@@ -26,10 +27,11 @@ module ActiveRecord
26
27
 
27
28
  def apply_set_attributes(*attribute_list)
28
29
  self.params.stringify_keys!
29
-
30
+ @@accessible_attribute_list ||= []
31
+
30
32
  # build attributes hash
31
33
  attributes = {}
32
- attribute_list = (@@accessible_attributes || []) if attribute_list.empty?
34
+ attribute_list = @@accessible_attribute_list if attribute_list.empty?
33
35
  attribute_list.each do |attribute|
34
36
  attributes[attribute] = self.params[attribute.to_s]
35
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jcnetdev-acts_as_applyable
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - RailsJedi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-18 00:00:00 -07:00
12
+ date: 2008-09-19 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency