acts_as_awardable 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/acts_as_awardable.gemspec +2 -2
- data/lib/asa/acts_as_awardable.rb +2 -10
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/acts_as_awardable.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_awardable}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["tim.teng"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-13}
|
13
13
|
s.description = %q{assign awardable items like equips, props and fabaos etc, internal project usage only}
|
14
14
|
s.email = %q{tim.rubist@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,11 +20,8 @@ module ActsAsAwardable
|
|
20
20
|
prefixes = ([] << options[:prefix]).flatten
|
21
21
|
|
22
22
|
delegated_columns.each_with_index do |col, idx|
|
23
|
-
|
24
23
|
prefix = (prefixes[idx].to_s + "_") if prefixes[idx]
|
25
|
-
|
26
24
|
module_eval <<-EOF
|
27
|
-
|
28
25
|
def #{prefix}award_attributes
|
29
26
|
@#{prefix}award_attributes ||= JSON.parse(self.send("#{col}".to_sym) || '{}')
|
30
27
|
end
|
@@ -39,16 +36,11 @@ module ActsAsAwardable
|
|
39
36
|
#{prefix}award_attributes[award_type.to_s] = values
|
40
37
|
end
|
41
38
|
end
|
39
|
+
values_hash
|
42
40
|
end
|
41
|
+
self.send("#{col}=", result.to_json)
|
43
42
|
end
|
44
|
-
|
45
|
-
def after_validation
|
46
|
-
super
|
47
|
-
self.send("#{col}=", @#{prefix}award_attributes.to_json)
|
48
|
-
end
|
49
|
-
|
50
43
|
EOF
|
51
|
-
|
52
44
|
end
|
53
45
|
|
54
46
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- tim.teng
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-06-
|
17
|
+
date: 2011-06-13 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|