needle_in_a_haystack 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 7e365c25451da6fb9d1ab929ece76bfea7e5753544818eb5e8650642ed5d10b6
4
- data.tar.gz: d926c7e2ad775dc46d5c38a48b352dfd1ffd369196f3c3aab7aabe40c915d142
3
+ metadata.gz: dcc57ef8ef5c022fd98794c87852be14133a293b05b765f5b1152384dbf4b944
4
+ data.tar.gz: 67a37aa74001245538ba6e467e28bd3a1a23117a1452dcd1af8b5c68e6ef8ad0
5
5
  SHA512:
6
- metadata.gz: 6cfd26955113913e7ef3f5f24435485f45d83dac53f54b92d10cc7199f6c48358c1aa8072cdd911bc4e700acbd184ccdab808a987775addd438654e88218c363
7
- data.tar.gz: 20f66d4f920165380f95fd2f981207131034f96a14b86d6019e62f9c77cc83127669bae046ef02c599a7dd210c716d9a6510582d4f6157fb5b34317e0bd40796
6
+ metadata.gz: bd9bfdf36861ad29009088e358833bca69a1612e078229d8cd4205a57386459bfaff8325cb967e474e7cc83b3df70b62586a8a9768ab8fb12c7ad3bb8176b40b
7
+ data.tar.gz: b752e74b8f878ed842691f85cb4bd6e89cfe116e880769447a92ab3107daf2be6f979acd349d1e72cff9352d7e5177dd3005a513deabbec31ccdd6ca32b9c183
@@ -1,25 +1,19 @@
1
1
  class HaystackTag < ApplicationRecord
2
- belongs_to :parent_tag, class_name: "NeedleInAHaystack::HaystackTag", optional: true
3
- has_many :children, class_name: "NeedleInAHaystack::HaystackTag", foreign_key: "parent_tag_id", dependent: :destroy, inverse_of: :parent_tag
2
+ belongs_to :parent_tag, class_name: "HaystackTag", optional: true
3
+ has_many :children, class_name: "HaystackTag", foreign_key: "parent_tag_id", dependent: :destroy, inverse_of: :parent_tag
4
4
  has_many :haystack_taggings, dependent: :destroy
5
5
  has_many :taggables, through: :haystack_taggings
6
6
 
7
- if NeedleInAHaystack.respond_to?(:configuration) && NeedleInAHaystack.configuration&.taggable_models
8
- NeedleInAHaystack.configuration.taggable_models.each do |model|
9
- has_many "taggable_#{model.name.underscore.pluralize}".to_sym, through: :haystack_taggings, source: :taggable, source_type: model.name
10
- end
11
- end
12
-
13
7
  validates :name, presence: true
14
8
  validates :description, presence: true
15
9
  validate :prevent_circular_reference
16
10
 
17
11
  def ancestors
18
12
  ancestors = []
19
- current_tag = self
20
- while current_tag.parent_tag
21
- ancestors << current_tag.parent_tag
22
- current_tag = current_tag.parent_tag
13
+ current = self
14
+ while current.parent_tag
15
+ ancestors << current.parent_tag
16
+ current = current.parent_tag
23
17
  end
24
18
  ancestors
25
19
  end
@@ -1 +1 @@
1
- VERSION = "1.0.1".freeze
1
+ VERSION = "1.0.2".freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: needle_in_a_haystack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frans Verberne