mongoid-simple-tags 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = mongoid-simple-tags {<img src="https://secure.travis-ci.org/chebyte/mongoid-simple-tags.png"/>}[http://travis-ci.org/chebyte/mongoid-simple-tags]
1
+ = mongoid-simple-tags {<img src="https://secure.travis-ci.org/chebyte/mongoid-simple-tags.png"/>}[http://travis-ci.org/chebyte/mongoid-simple-tags] {<img src="https://codeclimate.com/github/chebyte/mongoid-simple-tags.png" />}[https://codeclimate.com/github/chebyte/mongoid-simple-tags]
2
2
 
3
3
  mongoid-simple-tags is a basic and simple tagging system for mongoid using map-reduce function
4
4
  (no backwards compatibility with mongoid v2!)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -3,7 +3,7 @@ module Mongoid
3
3
  module Taggable
4
4
  def self.included(base)
5
5
  base.class_eval do |klass|
6
- klass.field :tags, :type => Array, :default => []
6
+ klass.field :tags, :type => Array, :default => [], localize: true
7
7
  klass.index({ tags: 1 }, { background: true })
8
8
 
9
9
  include InstanceMethods
@@ -29,11 +29,11 @@ module Mongoid
29
29
 
30
30
  module ClassMethods
31
31
 
32
- def all_tags(scope = {})
32
+ def all_tags(locale = I18n.locale, scope = {})
33
33
  map = %Q{
34
34
  function() {
35
- if(this.tags){
36
- this.tags.forEach(function(tag){
35
+ if(this.tags.#{locale}){
36
+ this.tags.#{locale}.forEach(function(tag){
37
37
  emit(tag, 1)
38
38
  });
39
39
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "mongoid-simple-tags"
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["chebyte"]
8
8
  s.email = ["maurotorres@gmail.com"]
@@ -106,14 +106,14 @@ describe "A Taggable model with scope" do
106
106
  end
107
107
 
108
108
  it "should return scoped tags when passing one option" do
109
- results = User.all_tags(organization_id: @organization_1.id)
109
+ results = User.all_tags(:en, organization_id: @organization_1.id)
110
110
  results.empty?.should be_false
111
111
 
112
112
  results.include?( {:name => "linux", :count => 2 } ).should be_true
113
113
  results.include?( {:name => "ubuntu", :count => 2 } ).should be_true
114
114
  results.include?( {:name => "tucuman", :count => 2 } ).should be_true
115
115
 
116
- results = User.all_tags(organization_id: @organization_2.id)
116
+ results = User.all_tags(:en, organization_id: @organization_2.id)
117
117
  results.empty?.should be_false
118
118
  results.include?( {:name =>"linux", :count => 1 } ).should be_true
119
119
  results.include?( {:name => "microsoft", :count => 1 } ).should be_true
@@ -122,7 +122,7 @@ describe "A Taggable model with scope" do
122
122
  end
123
123
 
124
124
  it "should return scoped tags when passing more than one option" do
125
- results = User.all_tags(organization_id: @organization_1.id, name: @user_1.name)
125
+ results = User.all_tags(:en, organization_id: @organization_1.id, name: @user_1.name)
126
126
 
127
127
  results.empty?.should be_false
128
128
  results.include?( {:name => "linux", :count => 1 } ).should be_true
@@ -131,7 +131,7 @@ describe "A Taggable model with scope" do
131
131
  end
132
132
 
133
133
  it "should return scoped tags when calling deprecated scoped_tags method" do
134
- results = User.all_tags(organization_id: @organization_1.id)
134
+ results = User.all_tags(:en, organization_id: @organization_1.id)
135
135
 
136
136
  results.empty?.should be_false
137
137
  results.include?( {:name => "linux", :count => 2 } ).should be_true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-simple-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec