jcnetdev-acts_as_applyable 0.2 → 0.3
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.
- data/acts_as_applyable.gemspec +2 -2
- data/lib/acts_as_applyable.rb +2 -4
- metadata +2 -2
data/acts_as_applyable.gemspec
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'acts_as_applyable'
|
|
3
|
-
s.version = '0.
|
|
4
|
-
s.date = '2008-09-
|
|
3
|
+
s.version = '0.3'
|
|
4
|
+
s.date = '2008-09-18'
|
|
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."
|
data/lib/acts_as_applyable.rb
CHANGED
|
@@ -5,14 +5,12 @@ module ActiveRecord
|
|
|
5
5
|
base.extend ClassMethods
|
|
6
6
|
base.class_eval do
|
|
7
7
|
include ActiveRecord::Acts::Applyable::InstanceMethods
|
|
8
|
-
cattr_accessor :accessible_attributes
|
|
9
|
-
self.accessible_attributes = []
|
|
10
8
|
end
|
|
11
9
|
end
|
|
12
10
|
|
|
13
11
|
module ClassMethods
|
|
14
12
|
def acts_as_applyable(*accessible_attributes)
|
|
15
|
-
|
|
13
|
+
@@accessible_attributes = accessible_attributes
|
|
16
14
|
end
|
|
17
15
|
end
|
|
18
16
|
|
|
@@ -31,7 +29,7 @@ module ActiveRecord
|
|
|
31
29
|
|
|
32
30
|
# build attributes hash
|
|
33
31
|
attributes = {}
|
|
34
|
-
attribute_list = accessible_attributes if attribute_list.empty?
|
|
32
|
+
attribute_list = (@@accessible_attributes || []) if attribute_list.empty?
|
|
35
33
|
attribute_list.each do |attribute|
|
|
36
34
|
attributes[attribute] = self.params[attribute.to_s]
|
|
37
35
|
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.
|
|
4
|
+
version: "0.3"
|
|
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-
|
|
12
|
+
date: 2008-09-18 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|