taxonomy_rails 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b78283c1e2ee99c61e3ddda642c70141704e6b4c
|
4
|
+
data.tar.gz: 958efcd796094d8b04c7a11e2d0cdcc6a07f0053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e94fb52cb2f7ff526198214039eb75d218452f7f666be3604e87f554e31171990044a709177c1a3b4717386baf40ddb729a665f508e0f6e01a03a6dc0b24aa0
|
7
|
+
data.tar.gz: 00a9f1935703c9439361ae3e421ce34daac5154bb3b7d5c70e57cb0bdab9d3f35a0df9d7bd074b3b8c4d1c162ebc0dc4920520958fc1f9521bdd01e1cb6d4a95
|
@@ -1,7 +1,17 @@
|
|
1
1
|
class Classification < ActiveRecord::Base
|
2
2
|
|
3
3
|
belongs_to :taxon, inverse_of: :classifications
|
4
|
+
belongs_to :taxonomy, inverse_of: :classifications
|
4
5
|
belongs_to :classifiable, polymorphic: true, inverse_of: :classification
|
5
6
|
|
6
|
-
validates :taxon_id, presence: true
|
7
|
+
validates :taxon_id, :taxonomy_id, presence: true
|
8
|
+
|
9
|
+
before_validation :copy_taxonomy_id
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def copy_taxonomy_id
|
14
|
+
self.taxonomy_id = self.taxon.taxonomy_id if taxon.present?
|
15
|
+
end
|
16
|
+
|
7
17
|
end
|
data/app/models/taxonomy.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taxonomy_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orgânica Digital
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- db/migrate/20150205160750_create_classifications.rb
|
88
88
|
- db/migrate/20150205164502_add_slug_to_taxon.rb
|
89
89
|
- db/migrate/20150210151659_change_taxon_slug_unique_index.rb
|
90
|
+
- db/migrate/20150508130643_add_taxonomy_id_to_classification.rb
|
90
91
|
- lib/generators/taxonomy_rails/taxonomy_rails_generator.rb
|
91
92
|
- lib/taxonomy_rails.rb
|
92
93
|
- lib/taxonomy_rails/engine.rb
|
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
112
|
version: '0'
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.4.
|
115
|
+
rubygems_version: 2.4.5
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: A simple taxonomy hierarchy for use in Rails projects.
|