activerecord-denormalize 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1caec859e66406b70fcf5873148df359e01f2d41
4
+ data.tar.gz: 1ff079a68a593a90cf732b9c0a07760293a9c7b0
5
+ SHA512:
6
+ metadata.gz: 6fef90d77a312c931abb7802083e2bbd9cca33b7edad1bec876796bf97c48a8658423766551da72c0c38c76fdd0ceb9bc16d86220186ed991f632454a42f08a2
7
+ data.tar.gz: b393812ec69fdb42bd3fa9d3aab8e357a734909fd9c33721c93eff232c8873fcb00df488e9cd87e48d4be3fb6e9c9f7c28d988473244691ccc8680e7542638bf
data/.gitignore CHANGED
@@ -8,6 +8,7 @@ InstalledFiles
8
8
  _yardoc
9
9
  coverage
10
10
  doc/
11
+ gemfiles/*.lock
11
12
  lib/bundler/man
12
13
  pkg
13
14
  rdoc
@@ -0,0 +1,7 @@
1
+ appraise 'activerecord-3.2' do
2
+ gem 'activerecord', '~> 3.2'
3
+ end
4
+
5
+ appraise 'activerecord-4.0' do
6
+ gem 'activerecord', '~> 4.0.0.beta1'
7
+ end
data/README.md CHANGED
@@ -49,6 +49,12 @@ Message.all.each do |msg|
49
49
  end
50
50
  ```
51
51
 
52
+ ## Running the test
53
+
54
+ ``` sh
55
+ $ bundle exec rake appraisal spec
56
+ ```
57
+
52
58
  ## Contributing
53
59
 
54
60
  1. Fork it
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
- require "bundler/gem_tasks"
1
+ require 'appraisal'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Run all specs'
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
+ t.verbose = true
8
+ end
@@ -22,5 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'activerecord'
23
23
  gem.add_dependency 'activerecord-postgres-hstore'
24
24
 
25
+ gem.add_development_dependency 'appraisal'
26
+ gem.add_development_dependency 'pg'
25
27
  gem.add_development_dependency 'rspec'
26
28
  end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 3.2"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 4.0.0.beta1"
6
+
7
+ gemspec :path=>"../"
@@ -1,9 +1,10 @@
1
- require 'activerecord-postgres-hstore'
1
+ require 'activerecord-postgres-hstore/coder'
2
2
 
3
3
  module ActiveRecord::Denormalize
4
4
  class << self
5
5
  def included(builder)
6
- builder.valid_options << :denormalize
6
+ # Support for ActiveRecord 3.2
7
+ builder.valid_options << :denormalize if builder.valid_options
7
8
  end
8
9
 
9
10
  def extract_attributes(obj, keys)
@@ -28,6 +29,11 @@ module ActiveRecord::Denormalize
28
29
  }
29
30
  end
30
31
 
32
+ # Support for ActiveRecord 4
33
+ def valid_options
34
+ super + [:denormalize]
35
+ end
36
+
31
37
  private
32
38
 
33
39
  def configure_denormalize(reflection)
@@ -52,7 +58,7 @@ module ActiveRecord::Denormalize
52
58
  mixin.redefine_method method_name do
53
59
  attrs = ActiveRecord::Denormalize.extract_attributes(self, attributes)
54
60
 
55
- __send__(dest_name).update_all ["#{store_in} = ?::hstore", attrs.to_hstore]
61
+ __send__(dest_name).update_all ["#{store_in} = ?::hstore", ActiveRecord::Coders::Hstore.dump(attrs)]
56
62
  end
57
63
 
58
64
  model.after_save method_name
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Denormalize
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,62 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-denormalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Keita Urashima
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-17 00:00:00.000000000 Z
11
+ date: 2013-04-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activerecord-postgres-hstore
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pg
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
44
67
  - !ruby/object:Gem::Version
45
68
  version: '0'
46
69
  - !ruby/object:Gem::Dependency
47
70
  name: rspec
48
71
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
72
  requirements:
51
- - - ! '>='
73
+ - - '>='
52
74
  - !ruby/object:Gem::Version
53
75
  version: '0'
54
76
  type: :development
55
77
  prerelease: false
56
78
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
79
  requirements:
59
- - - ! '>='
80
+ - - '>='
60
81
  - !ruby/object:Gem::Version
61
82
  version: '0'
62
83
  description: Denormalize fields in ActiveRecord.
@@ -67,11 +88,14 @@ extensions: []
67
88
  extra_rdoc_files: []
68
89
  files:
69
90
  - .gitignore
91
+ - Appraisals
70
92
  - Gemfile
71
93
  - LICENSE.txt
72
94
  - README.md
73
95
  - Rakefile
74
96
  - activerecord-denormalize.gemspec
97
+ - gemfiles/activerecord_3.2.gemfile
98
+ - gemfiles/activerecord_4.0.gemfile
75
99
  - lib/active_record/denormalize.rb
76
100
  - lib/activerecord-denormalize.rb
77
101
  - lib/activerecord-denormalize/version.rb
@@ -79,28 +103,28 @@ files:
79
103
  - spec/spec_helper.rb
80
104
  homepage: ''
81
105
  licenses: []
106
+ metadata: {}
82
107
  post_install_message:
83
108
  rdoc_options: []
84
109
  require_paths:
85
110
  - lib
86
111
  required_ruby_version: !ruby/object:Gem::Requirement
87
- none: false
88
112
  requirements:
89
- - - ! '>='
113
+ - - '>='
90
114
  - !ruby/object:Gem::Version
91
115
  version: '0'
92
116
  required_rubygems_version: !ruby/object:Gem::Requirement
93
- none: false
94
117
  requirements:
95
- - - ! '>='
118
+ - - '>='
96
119
  - !ruby/object:Gem::Version
97
120
  version: '0'
98
121
  requirements: []
99
122
  rubyforge_project:
100
- rubygems_version: 1.8.23
123
+ rubygems_version: 2.0.0
101
124
  signing_key:
102
- specification_version: 3
125
+ specification_version: 4
103
126
  summary: ''
104
127
  test_files:
105
128
  - spec/active_record/denormalize_spec.rb
106
129
  - spec/spec_helper.rb
130
+ has_rdoc: