hydra_attribute 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -1
- data/README.md +6 -6
- data/features/step_definitions/class_steps.rb +2 -2
- data/gemfiles/3.1.gemfile.lock +2 -1
- data/gemfiles/3.2.gemfile.lock +2 -1
- data/hydra_attribute.gemspec +2 -2
- data/lib/generators/hydra_attribute/install/USAGE +1 -1
- data/lib/hydra_attribute/active_record.rb +2 -2
- data/lib/hydra_attribute/association_builder.rb +1 -1
- data/lib/hydra_attribute/version.rb +1 -1
- data/spec/hydra_attribute/active_record_spec.rb +5 -7
- metadata +18 -18
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -65,12 +65,12 @@ rake db:migrate
|
|
65
65
|
class SimpleProduct < Product
|
66
66
|
attr_accessible :name, :title, :code, :quantity, :price, :active, :description
|
67
67
|
|
68
|
-
define_hydra_attributes do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
define_hydra_attributes do
|
69
|
+
string :title, :code
|
70
|
+
integer :quantity
|
71
|
+
float :price
|
72
|
+
boolean :active
|
73
|
+
text :description
|
74
74
|
end
|
75
75
|
end
|
76
76
|
```
|
@@ -10,9 +10,9 @@ end
|
|
10
10
|
|
11
11
|
Given /^create model class "([^"]+)" as "([^"]+)" with hydra attributes:$/ do |klass, sti_class, table|
|
12
12
|
Object.const_set klass, Class.new(Object.const_get(sti_class)) {
|
13
|
-
define_hydra_attributes do
|
13
|
+
define_hydra_attributes do
|
14
14
|
table.hashes.each do |hash|
|
15
|
-
|
15
|
+
send(hash[:type], hash[:name].to_sym)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
}
|
data/gemfiles/3.1.gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/kostyantyn/Sites/github/gems/hydra_attribute
|
3
3
|
specs:
|
4
|
-
hydra_attribute (0.1.
|
4
|
+
hydra_attribute (0.1.2.beta1)
|
5
5
|
activerecord (>= 3.1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -56,5 +56,6 @@ DEPENDENCIES
|
|
56
56
|
cucumber
|
57
57
|
database_cleaner
|
58
58
|
hydra_attribute!
|
59
|
+
rake
|
59
60
|
rspec
|
60
61
|
sqlite3
|
data/gemfiles/3.2.gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/kostyantyn/Sites/github/gems/hydra_attribute
|
3
3
|
specs:
|
4
|
-
hydra_attribute (0.1.
|
4
|
+
hydra_attribute (0.1.2.beta1)
|
5
5
|
activerecord (>= 3.1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -56,5 +56,6 @@ DEPENDENCIES
|
|
56
56
|
cucumber
|
57
57
|
database_cleaner
|
58
58
|
hydra_attribute!
|
59
|
+
rake
|
59
60
|
rspec
|
60
61
|
sqlite3
|
data/hydra_attribute.gemspec
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/hydra_attribute/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.author = 'Kostyantyn Stepanyuk'
|
6
6
|
gem.email = 'kostya.stepanyuk@gmail.com'
|
7
|
-
gem.summary = 'hydra_attribute
|
8
|
-
gem.description = 'hydra_attribute
|
7
|
+
gem.summary = 'hydra_attribute is an implementation of EAV pattern for ActiveRecord models.'
|
8
|
+
gem.description = 'hydra_attribute is an implementation of EAV pattern for ActiveRecord models.'
|
9
9
|
gem.homepage = 'https://github.com/kostyantyn/hydra_attribute'
|
10
10
|
gem.files = `git ls-files`.split("\n")
|
11
11
|
gem.test_files = `git ls-files -- Appraisals {spec,features,gemfiles}/*`.split("\n")
|
@@ -25,7 +25,7 @@ module HydraAttribute
|
|
25
25
|
def add_association_for_class
|
26
26
|
assoc = config.association(@type)
|
27
27
|
unless @klass.reflect_on_association(assoc)
|
28
|
-
@klass.has_many assoc, as: :entity, class_name: config.associated_model_name(@type), autosave: true, dependent: :
|
28
|
+
@klass.has_many assoc, as: :entity, class_name: config.associated_model_name(@type), autosave: true, dependent: :delete_all
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -4,16 +4,14 @@ describe HydraAttribute::ActiveRecord do
|
|
4
4
|
let(:klass) { Class.new.extend(HydraAttribute::ActiveRecord) }
|
5
5
|
|
6
6
|
describe '#define_hydra_attributes' do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
builder.should be_an_instance_of(HydraAttribute::Builder)
|
12
|
-
builder.klass.should be_equal(klass)
|
13
|
-
|
7
|
+
it 'should yield block in builder scope' do
|
8
|
+
klass.define_hydra_attributes do
|
9
|
+
self.class.should == HydraAttribute::Builder
|
10
|
+
end
|
14
11
|
end
|
15
12
|
|
16
13
|
it 'should include HydraAttribute::ActiveRecord::Scoping to class' do
|
14
|
+
klass.define_hydra_attributes {}
|
17
15
|
klass.should include(HydraAttribute::ActiveRecord::Scoping)
|
18
16
|
end
|
19
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra_attribute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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: 2012-06-
|
12
|
+
date: 2012-06-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152687640 !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: *
|
24
|
+
version_requirements: *2152687640
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152687240 !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: *
|
35
|
+
version_requirements: *2152687240
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &2152686780 !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: *
|
46
|
+
version_requirements: *2152686780
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sqlite3
|
49
|
-
requirement: &
|
49
|
+
requirement: &2152686340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152686340
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: database_cleaner
|
60
|
-
requirement: &
|
60
|
+
requirement: &2152685920 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152685920
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: appraisal
|
71
|
-
requirement: &
|
71
|
+
requirement: &2152685500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2152685500
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rake
|
82
|
-
requirement: &
|
82
|
+
requirement: &2152685080 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,8 +87,8 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
91
|
-
description: hydra_attribute
|
90
|
+
version_requirements: *2152685080
|
91
|
+
description: hydra_attribute is an implementation of EAV pattern for ActiveRecord
|
92
92
|
models.
|
93
93
|
email: kostya.stepanyuk@gmail.com
|
94
94
|
executables: []
|
@@ -175,7 +175,7 @@ rubyforge_project:
|
|
175
175
|
rubygems_version: 1.8.10
|
176
176
|
signing_key:
|
177
177
|
specification_version: 3
|
178
|
-
summary: hydra_attribute
|
178
|
+
summary: hydra_attribute is an implementation of EAV pattern for ActiveRecord models.
|
179
179
|
test_files:
|
180
180
|
- Appraisals
|
181
181
|
- features/attribute_methods.feature
|