has_meta_data 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +7 -6
- data/Gemfile.lock +3 -3
- data/README.rdoc +14 -0
- data/lib/has_meta_data.rb +3 -3
- data/lib/has_meta_data/version.rb +1 -1
- data/spec/db/test.sqlite3 +0 -0
- metadata +22 -21
data/Appraisals
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
appraise "
|
1
|
+
appraise "3.0" do
|
2
2
|
gem "rails", "~> 3.0.12"
|
3
|
-
gem "has_meta_data", :path => "../"
|
4
3
|
end
|
5
4
|
|
6
|
-
appraise "
|
5
|
+
appraise "3.1" do
|
7
6
|
gem "rails", "~> 3.1.4"
|
8
|
-
gem "has_meta_data", :path => "../"
|
9
7
|
end
|
10
8
|
|
11
|
-
appraise "
|
9
|
+
appraise "3.2" do
|
12
10
|
gem "rails", "~> 3.2.2"
|
13
|
-
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "4.0" do
|
14
|
+
gem "rails", "~> 4.0.beta1"
|
14
15
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
has_meta_data (1.
|
4
|
+
has_meta_data (1.1.0)
|
5
5
|
activerecord (>= 3.0.0)
|
6
6
|
activesupport (>= 3.0.0)
|
7
7
|
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
bundler
|
24
24
|
rake
|
25
25
|
arel (3.0.2)
|
26
|
-
builder (3.0.
|
26
|
+
builder (3.0.4)
|
27
27
|
diff-lcs (1.1.3)
|
28
28
|
factory_girl (2.6.4)
|
29
29
|
activesupport (>= 2.3.9)
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
diff-lcs (~> 1.1.3)
|
45
45
|
rspec-mocks (2.9.0)
|
46
46
|
sqlite3 (1.3.5)
|
47
|
-
tzinfo (0.3.
|
47
|
+
tzinfo (0.3.35)
|
48
48
|
|
49
49
|
PLATFORMS
|
50
50
|
ruby
|
data/README.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
{<img src="https://secure.travis-ci.org/rubiety/has_meta_data.png?branch=master" alt="Build Status" />}[http://travis-ci.org/rubiety/has_meta_data]
|
2
|
+
{<img src="https://gemnasium.com/rubiety/has_meta_data.png" alt="Dependency Status" />}[https://gemnasium.com/rubiety/has_meta_data]
|
3
|
+
{<img src="https://codeclimate.com/github/rubiety/has_meta_data.png" />}[https://codeclimate.com/github/rubiety/has_meta_data]
|
4
|
+
|
1
5
|
== Has Meta Data
|
2
6
|
|
3
7
|
This plugin allows you to extend one of your models with additional supplementary data stored in another table through a has_one relationship. The benefit of this plugin over a simple has_one is that the meta model class is dynamically defined (though extendable via the has_meta_data declaration) and fields on the meta model are automatically delegated to from the main model, allowing you to work solely with your primary model and not worry about the storage of the data in a separate meta table. This plugin also automatically handles creation of the meta model if you set a field on your model that exists in the meta model table.
|
@@ -83,3 +87,13 @@ context by passing a block to has_draft:
|
|
83
87
|
end
|
84
88
|
|
85
89
|
end
|
90
|
+
|
91
|
+
== Running Tests
|
92
|
+
|
93
|
+
This gem uses appraisal to test with different versions of the dependencies. See Appraisal first for which versions are tested.
|
94
|
+
|
95
|
+
# Just the gems locked in Gemfile.lock
|
96
|
+
$ bundle exec rake test
|
97
|
+
|
98
|
+
# All of the Appraisals:
|
99
|
+
$ bundle exec rake all
|
data/lib/has_meta_data.rb
CHANGED
@@ -22,8 +22,8 @@ module HasMetaData
|
|
22
22
|
:foreign_key => meta_data_foreign_key,
|
23
23
|
:dependent => :destroy
|
24
24
|
|
25
|
-
scope :with_meta, includes(:meta).where("#{meta_data_table_name}.id IS NOT NULL")
|
26
|
-
scope :without_meta, includes(:meta).where("#{meta_data_table_name}.id IS NULL")
|
25
|
+
scope :with_meta, lambda { includes(:meta).where("#{meta_data_table_name}.id IS NOT NULL") }
|
26
|
+
scope :without_meta, lambda { includes(:meta).where("#{meta_data_table_name}.id IS NULL") }
|
27
27
|
end
|
28
28
|
|
29
29
|
# Dynamically Create Model::Meta Class
|
@@ -31,7 +31,7 @@ module HasMetaData
|
|
31
31
|
|
32
32
|
meta_data_class.cattr_accessor :original_class
|
33
33
|
meta_data_class.original_class = self
|
34
|
-
meta_data_class.
|
34
|
+
meta_data_class.table_name = meta_data_table_name
|
35
35
|
|
36
36
|
# Draft Parent Association
|
37
37
|
meta_data_class.belongs_to self.to_s.demodulize.underscore.to_sym, :class_name => "::#{self.to_s}", :foreign_key => meta_data_foreign_key
|
data/spec/db/test.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_meta_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.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:
|
12
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70101670106300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70101670106300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activerecord
|
27
|
-
requirement: &
|
27
|
+
requirement: &70101670105820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70101670105820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70101670105340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70101670105340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: factory_girl
|
49
|
-
requirement: &
|
49
|
+
requirement: &70101670104860 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.6.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70101670104860
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: faker
|
60
|
-
requirement: &
|
60
|
+
requirement: &70101670104380 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70101670104380
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
|
-
requirement: &
|
71
|
+
requirement: &70101670103900 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.3.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70101670103900
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: appraisal
|
82
|
-
requirement: &
|
82
|
+
requirement: &70101670103420 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.4.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70101670103420
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdoc
|
93
|
-
requirement: &
|
93
|
+
requirement: &70101670102940 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '3.12'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70101670102940
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rake
|
104
|
-
requirement: &
|
104
|
+
requirement: &70101670102560 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70101670102560
|
113
113
|
description: Create one model backed by a primary table and a supplementary 'meta'
|
114
114
|
table.
|
115
115
|
email: ben@railsgarden.com
|
@@ -153,8 +153,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: 1.3.4
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project: has_meta_data
|
156
|
-
rubygems_version: 1.8.
|
156
|
+
rubygems_version: 1.8.16
|
157
157
|
signing_key:
|
158
158
|
specification_version: 3
|
159
159
|
summary: Extended attributes in an attached meta table.
|
160
160
|
test_files: []
|
161
|
+
has_rdoc:
|