gutentag 0.4.0 → 0.5.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: fc8dba706d5b7e3075cf6043b26ab140b622fcb3
4
- data.tar.gz: ac691b782f055f9f6d204731ba8b64d5ff21eb18
3
+ metadata.gz: d85f0029e162907bb00faea63223b0b8c1207fec
4
+ data.tar.gz: fa0aee9f34395cb1af2885da0c70a04427e26da7
5
5
  SHA512:
6
- metadata.gz: 245dc0526ff19021c898615a041e8938056ff459cd863e1a896b0990a0130826c4af08c5362e1e13806014d09c45939e7066af7b7a3fe8feda8f8475be3eb27d
7
- data.tar.gz: cc4364399ddd4ec9d7dc1964f3359a02e32f1cf5af13baf2da3bee8b88f7a721a5e162f978c6f961c95401e201b9a26df581545e15b23d22134356545ffa553e
6
+ metadata.gz: 6bd5622a2935365c92ef8bab94768913a194fd34c98f28057beb8369b875d40e0797d525593bf7641daa9f360765d72560dd4998cdb8409d1241a4829cf7b5b7
7
+ data.tar.gz: 9b17cb1f4ae54e5205c6eaf8ee514c3e48bca171ee392ca18feb80562c5fdaae381eeeaefe912a537e922251d375fb152aa4b9c848784b53e5fe284a5444d36d
data/README.md CHANGED
@@ -10,9 +10,14 @@ This was built partly as a proof-of-concept, and partly to see how a tagging gem
10
10
 
11
11
  ## Installation
12
12
 
13
+ **Upgrading?** Gutentag has recently switched table names from `tags` and `taggings` to `gutentag_tags` and `gutentag_taggings`, to avoid conflicting with the more generic table names that may exist in Rails apps already. If you already have been using Gutentag, you'll need to create a migration manually that renames these tables:
14
+
15
+ rename_table :tags, :gutentag_tags
16
+ rename_table :taggings, :gutentag_taggings
17
+
13
18
  Get it into your Gemfile - and don't forget the version constraint!
14
19
 
15
- gem 'gutentag', '~> 0.4.0'
20
+ gem 'gutentag', '~> 0.5.0'
16
21
 
17
22
  Next: your tags get persisted to your database, so let's import and run the migrations to get the tables set up:
18
23
 
@@ -1,10 +1,12 @@
1
1
  class Gutentag::Tag < ActiveRecord::Base
2
+ self.table_name = 'gutentag_tags'
3
+
2
4
  has_many :taggings, :class_name => 'Gutentag::Tagging',
3
5
  :dependent => :destroy
4
6
 
5
7
  attr_accessible :name if Rails.version.to_s < '4.0.0'
6
8
 
7
- scope :by_weight, ->{ order('tags.taggings_count DESC') }
9
+ scope :by_weight, ->{ order('gutentag_tags.taggings_count DESC') }
8
10
 
9
11
  validates :name, :presence => true, :uniqueness => {:case_sensitive => false}
10
12
 
@@ -1,4 +1,6 @@
1
1
  class Gutentag::Tagging < ActiveRecord::Base
2
+ self.table_name = 'gutentag_taggings'
3
+
2
4
  belongs_to :taggable, :polymorphic => true
3
5
  belongs_to :tag, :class_name => 'Gutentag::Tag', :counter_cache => true
4
6
 
@@ -1,27 +1,27 @@
1
1
  class GutentagTables < ActiveRecord::Migration
2
2
  def up
3
- create_table :taggings do |t|
3
+ create_table :gutentag_taggings do |t|
4
4
  t.integer :tag_id, :null => false
5
5
  t.integer :taggable_id, :null => false
6
6
  t.string :taggable_type, :null => false
7
7
  t.timestamps
8
8
  end
9
9
 
10
- add_index :taggings, :tag_id
11
- add_index :taggings, [:taggable_type, :taggable_id]
12
- add_index :taggings, [:taggable_type, :taggable_id, :tag_id],
10
+ add_index :gutentag_taggings, :tag_id
11
+ add_index :gutentag_taggings, [:taggable_type, :taggable_id]
12
+ add_index :gutentag_taggings, [:taggable_type, :taggable_id, :tag_id],
13
13
  :unique => true, :name => 'unique_taggings'
14
14
 
15
- create_table :tags do |t|
15
+ create_table :gutentag_tags do |t|
16
16
  t.string :name, :null => false
17
17
  t.timestamps
18
18
  end
19
19
 
20
- add_index :tags, :name, :unique => true
20
+ add_index :gutentag_tags, :name, :unique => true
21
21
  end
22
22
 
23
23
  def down
24
- drop_table :tags
25
- drop_table :taggings
24
+ drop_table :gutentag_tags
25
+ drop_table :gutentag_taggings
26
26
  end
27
27
  end
@@ -1,7 +1,7 @@
1
1
  class GutentagCacheCounter < ActiveRecord::Migration
2
2
  def up
3
- add_column :tags, :taggings_count, :integer, :default => 0
4
- add_index :tags, :taggings_count
3
+ add_column :gutentag_tags, :taggings_count, :integer, :default => 0
4
+ add_index :gutentag_tags, :taggings_count
5
5
 
6
6
  Gutentag::Tag.reset_column_information
7
7
  Gutentag::Tag.pluck(:id).each do |tag_id|
@@ -10,6 +10,6 @@ class GutentagCacheCounter < ActiveRecord::Migration
10
10
  end
11
11
 
12
12
  def down
13
- remove_column :tags, :taggings_count
13
+ remove_column :gutentag_tags, :taggings_count
14
14
  end
15
15
  end
@@ -1,11 +1,11 @@
1
1
  class NoNullCounters < ActiveRecord::Migration
2
2
  def up
3
- change_column :tags, :taggings_count, :integer, :default => 0,
3
+ change_column :gutentag_tags, :taggings_count, :integer, :default => 0,
4
4
  :null => false
5
5
  end
6
6
 
7
7
  def down
8
- change_column :tags, :taggings_count, :integer, :default => 0,
8
+ change_column :gutentag_tags, :taggings_count, :integer, :default => 0,
9
9
  :null => true
10
10
  end
11
11
  end
data/gutentag.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'gutentag'
4
- s.version = '0.4.0'
4
+ s.version = '0.5.0'
5
5
  s.authors = ['Pat Allan']
6
6
  s.email = ['pat@freelancing-gods.com']
7
7
  s.homepage = 'https://github.com/pat/gutentag'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gutentag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-03 00:00:00.000000000 Z
11
+ date: 2013-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.0.2
123
+ rubygems_version: 2.1.0
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Good Tags