geothird_friendly_id 4.0.9.5 → 4.0.9.6

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: e4517be54a99468e6efcce36bcfeaebf0c895ef9
4
- data.tar.gz: e5b63a953bc1e79134fa3c782cf246d3ef0b5703
3
+ metadata.gz: 865522c23934f0ec1b360a57d3659b07137ed2c3
4
+ data.tar.gz: c3e371c31cddcfce242dfcade11eedde48b7e5b7
5
5
  SHA512:
6
- metadata.gz: e140a454c0774bd355b412b94c3b808bb483b5e13bebbdbc1505b8c89cead604c703e03964c2966bf084e6fa797d79fef97424af126303228cf1ba36195fa122
7
- data.tar.gz: 731bd86bb8a54ddfef13632a427fbc56f8c78d510c308fe7b6935fbd11cd3b07dc946ad756af93f4292295f6d3404f4d4cb161f9bcf7762b300500cdaf9c8aa1
6
+ metadata.gz: 7253a59b9bd02bbc45c0935420d988d39c1fa2654e7c02feca1c5e59afeec6d72631c395364daa6e1232c5ee5ee1ab4fa33cf56927a2884df50d525460965725
7
+ data.tar.gz: 732091b1b707108e8158dd4c2b21605ddd98d1cd9b1f9a178b0043ad0b9c578eaa7c9060b6bf342e7f397942d8d2f93b5f4f72aba73f40e7d1f2d9c8c7257ea9
@@ -15,6 +15,8 @@ Gem::Specification.new do |s|
15
15
  s.test_files = `git ls-files -- {test}/*`.split("\n")
16
16
  s.require_paths = ["lib"]
17
17
 
18
+ s.add_dependency 'acts_as_paranoid', '0.4.1'
19
+
18
20
  s.add_development_dependency "railties", "~> 3.2.0"
19
21
  s.add_development_dependency "activerecord", "~> 3.2.0"
20
22
  s.add_development_dependency "minitest", "3.2.0"
data/lib/friendly_id.rb CHANGED
@@ -45,7 +45,7 @@ with numeric ids:
45
45
  module FriendlyId
46
46
 
47
47
  # The current version.
48
- VERSION = "4.0.9.5"
48
+ VERSION = "4.0.9.6"
49
49
 
50
50
  @mutex = Mutex.new
51
51
 
@@ -221,9 +221,9 @@ often better and easier to use {FriendlyId::Slugged slugs}.
221
221
  relation = relation_class.new(self, arel_table)
222
222
 
223
223
  if finder_needs_type_condition?
224
- relation.with_deleted.where(type_condition).create_with(inheritance_column.to_sym => sti_name)
224
+ relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name)
225
225
  else
226
- relation.with_deleted
226
+ relation
227
227
  end
228
228
  end
229
229
 
@@ -14,7 +14,7 @@ module FriendlyId
14
14
  # @see FriendlyId::ObjectUtils
15
15
  def find_one(id)
16
16
  return super if id.unfriendly_id?
17
- with_deleted.where(@klass.friendly_id_config.query_field => id).first or super
17
+ where(@klass.friendly_id_config.query_field => id).first or super
18
18
  end
19
19
 
20
20
  # FriendlyId overrides this method to make it possible to use friendly id's
@@ -124,7 +124,7 @@ method.
124
124
  pkey = sluggable_class.primary_key
125
125
  value = sluggable.send pkey
126
126
 
127
- scope = Slug.where("slug = ? OR slug LIKE ?", normalized, wildcard)
127
+ scope = Slug.with_deleted.where("slug = ? OR slug LIKE ?", normalized, wildcard)
128
128
  scope = scope.where(:sluggable_type => sluggable_class.to_s)
129
129
  scope = scope.where("sluggable_id <> ?", value) unless sluggable.new_record?
130
130
  scope.order("LENGTH(slug) DESC, slug DESC")
@@ -2,10 +2,11 @@ class CreateFriendlyIdSlugs < ActiveRecord::Migration
2
2
 
3
3
  def self.up
4
4
  create_table :friendly_id_slugs do |t|
5
- t.string :slug, :null => false
6
- t.integer :sluggable_id, :null => false
7
- t.string :sluggable_type, :limit => 40
8
- t.datetime :created_at
5
+ t.string :slug, :null => false
6
+ t.integer :sluggable_id, :null => false
7
+ t.string :sluggable_type, :limit => 40
8
+ t.datetime :created_at
9
+ t.deleted_at :boolean
9
10
  end
10
11
  add_index :friendly_id_slugs, :sluggable_id
11
12
  add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true
@@ -139,7 +139,7 @@ an example of one way to set this up:
139
139
  def conflict
140
140
  columns = friendly_id_config.scope_columns
141
141
  matched = columns.inject(conflicts) do |memo, column|
142
- memo.with_deleted.where(column => sluggable.send(column))
142
+ memo.where(column => sluggable.send(column))
143
143
  end
144
144
 
145
145
  matched.first
@@ -3,6 +3,7 @@ module FriendlyId
3
3
  #
4
4
  # @see FriendlyId::History
5
5
  class Slug < ActiveRecord::Base
6
+ acts_as_paranoid column_type: 'boolean'
6
7
  self.table_name = "friendly_id_slugs"
7
8
  belongs_to :sluggable, :polymorphic => true
8
9
 
@@ -57,8 +57,8 @@ module FriendlyId
57
57
  base = "#{column} = ? OR #{column} LIKE ?"
58
58
  # Awful hack for SQLite3, which does not pick up '\' as the escape character without this.
59
59
  base << "ESCAPE '\\'" if sluggable.connection.adapter_name =~ /sqlite/i
60
- scope = sluggable_class.unscoped.with_deleted.where(base, normalized, wildcard)
61
- scope = scope.with_deleted.where("#{pkey} <> ?", value) unless sluggable.new_record?
60
+ scope = sluggable_class.unscoped.where(base, normalized, wildcard)
61
+ scope = scope.where("#{pkey} <> ?", value) unless sluggable.new_record?
62
62
  scope = scope.order("LENGTH(#{column}) DESC, #{column} DESC")
63
63
  end
64
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geothird_friendly_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.9.5
4
+ version: 4.0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -11,6 +11,20 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2013-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: acts_as_paranoid
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.4.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 0.4.1
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: railties
16
30
  requirement: !ruby/object:Gem::Requirement