piggyback 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG +4 -0
  2. data/Rakefile +1 -1
  3. data/lib/piggyback.rb +18 -6
  4. data/piggyback.gemspec +2 -2
  5. metadata +10 -10
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ = 0.6.0 / 2012-02-10
2
+
3
+ * Conform to ActiveRecord 3.2.1
4
+
1
5
  = 0.5.0 / 2011-11-19
2
6
 
3
7
  * Changed syntax for attribute mappings
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rake'
2
2
  require 'echoe'
3
3
 
4
- Echoe.new('piggyback', '0.5.0') do |p|
4
+ Echoe.new('piggyback', '0.6.0') do |p|
5
5
 
6
6
  p.description = "Piggyback attributes from associated models with ActiveRecord"
7
7
  p.url = "http://github.com/juni0r/piggyback"
data/lib/piggyback.rb CHANGED
@@ -9,15 +9,27 @@ module Piggyback
9
9
  module ClassMethods
10
10
 
11
11
  def define_attribute_methods
12
- piggyback_attributes.values.each do |attribute|
12
+ @attribute_methods_mutex.synchronize do
13
+ return if attribute_methods_generated?
14
+
15
+ columns = []
16
+
17
+ piggyback_attributes.values.each do |attribute|
13
18
 
14
- if column = attribute.column
15
- columns_hash[attribute.name] = column
16
- end
19
+ if column = attribute.column
20
+ columns_hash[attribute.name] = column
21
+ columns << attribute.name
22
+ end
17
23
 
18
- if klass = attribute.serialized_class
19
- serialized_attributes[attribute.name] = klass
24
+ if klass = attribute.serialized_class
25
+ serialized_attributes[attribute.name] = klass
26
+ end
20
27
  end
28
+
29
+ # This stunt is to call "super.super"
30
+ _define_attribute_methods = ActiveModel::AttributeMethods::ClassMethods::instance_method(:define_attribute_methods)
31
+ _define_attribute_methods.bind(self).call(columns)
32
+
21
33
  end
22
34
  super
23
35
  end
data/piggyback.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "piggyback"
5
- s.version = "0.5.0"
5
+ s.version = "0.6.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andreas Korth"]
9
- s.date = "2011-11-19"
9
+ s.date = "2012-02-10"
10
10
  s.description = "Piggyback attributes from associated models with ActiveRecord"
11
11
  s.email = "andreas.korth@gmail.com"
12
12
  s.extra_rdoc_files = ["CHANGELOG", "README.markdown", "lib/piggyback.rb"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggyback
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-19 00:00:00.000000000 Z
12
+ date: 2012-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &2152819980 !ruby/object:Gem::Requirement
16
+ requirement: &2167595120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152819980
24
+ version_requirements: *2167595120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: echoe
27
- requirement: &2152819560 !ruby/object:Gem::Requirement
27
+ requirement: &2167594700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2152819560
35
+ version_requirements: *2167594700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2152819100 !ruby/object:Gem::Requirement
38
+ requirement: &2167594240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152819100
46
+ version_requirements: *2167594240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &2152818640 !ruby/object:Gem::Requirement
49
+ requirement: &2167593780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2152818640
57
+ version_requirements: *2167593780
58
58
  description: Piggyback attributes from associated models with ActiveRecord
59
59
  email: andreas.korth@gmail.com
60
60
  executables: []