has_tags 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa564f912468812fe9593203b9e5c699726b42b7
4
- data.tar.gz: d9678862c27bbc193e174562c31de35959c83a83
3
+ metadata.gz: 8ad1ceeb59db26549f51f3470e4b2fd2dbeb0986
4
+ data.tar.gz: 31705964c92458f7296f341044343d9700223bf8
5
5
  SHA512:
6
- metadata.gz: bb406ba5cda841342fa0761cb8e7ba04476dcbc6e3720d42b47ba75be8eb47efa09b515931cc441be044645d8c4ad7496084853d0bf5359b8e0c33a0b755f83d
7
- data.tar.gz: 7ea802c4e3a5f0d27909dc47e2f9cd20ee301dc54b8aaf9b880951f0c0dcb49eaa30bd091399712fe89f6ea6a6f6a119180c5af890057997d34fcdca3df56441
6
+ metadata.gz: b7f42b7bd4fb85e5e2559242d90e8c3e43ed439e8e343f36b8c3380185873b24291d32b97853df8d7810952bdb6d1097caaecbac7353b07edee9bf2ed9652f24
7
+ data.tar.gz: 9ed1506104d3996713dc5bf9638df265ce1dd0aaa65f5e20933a6cd5f5a2e29af2053b483c24eb95786ab7a46b97bba290a5353f123006c0be10f54aab35333c
data/README.md CHANGED
@@ -47,7 +47,7 @@ class PostController < ActiveRecord::Base
47
47
  end
48
48
  ```
49
49
 
50
- <code>tag_list</code> should be a string with tags separated by commas, or colons to make a context tag.
50
+ <code>tag_list</code> should be a string with tags separated by commas, or colons to create a context tag.
51
51
 
52
52
  ### Examples
53
53
 
@@ -62,7 +62,7 @@ For creating tags within tags, where to top-level tag acts as the context or par
62
62
  This creates three tags: Sports, Hockey and Food. Sports is now the context in which Hockey lives. Now we can call:
63
63
 
64
64
  ```ruby
65
- context = Tag.find_by(name: "Sports")
65
+ context = HasTags::Tag.find_by(name: "Sports")
66
66
 
67
67
  context.tags # => Hockey tag
68
68
  ```
@@ -72,7 +72,7 @@ The context tag syntax can be nested like so:
72
72
  "Sports:Hockey:Strategy"
73
73
 
74
74
  ```ruby
75
- strategy = Tag.find_by(name: "Strategy")
75
+ strategy = HasTags::Tag.find_by(name: "Strategy")
76
76
 
77
77
  hockey = strategy.context # => Hockey tag
78
78
 
@@ -27,6 +27,7 @@ module HasTags
27
27
  module InstanceMethods
28
28
  def save_taggings
29
29
  taggings = HasTags::Tagging.where(taggable_type: self.class.to_s, taggable_id: nil)
30
+ puts taggings.map(&:attributes)
30
31
  taggings.each do |tagging|
31
32
  tagging.taggable_id = self.id
32
33
  tagging.save
@@ -46,7 +47,7 @@ module HasTags
46
47
  else
47
48
  tag = HasTags::Tag.where(name: name, context_id: Tag.find_by(name: names[index-1]).id).first_or_create!
48
49
  end
49
- HasTags::Tagging.where(tag_id: tag.id, taggable_type: self.class.to_s).first_or_create!
50
+ HasTags::Tagging.where(tag_id: tag.id, taggable_type: self.class.to_s).create!
50
51
  end
51
52
  end
52
53
  end
@@ -1,3 +1,3 @@
1
1
  module HasTags
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garrett Martin