geothird_friendly_id 4.0.9.5 → 4.0.9.6
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 +4 -4
- data/geothird_friendly_id.gemspec +2 -0
- data/lib/friendly_id.rb +1 -1
- data/lib/friendly_id/base.rb +2 -2
- data/lib/friendly_id/finder_methods.rb +1 -1
- data/lib/friendly_id/history.rb +1 -1
- data/lib/friendly_id/migration.rb +5 -4
- data/lib/friendly_id/scoped.rb +1 -1
- data/lib/friendly_id/slug.rb +1 -0
- data/lib/friendly_id/slug_generator.rb +2 -2
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 865522c23934f0ec1b360a57d3659b07137ed2c3
|
4
|
+
data.tar.gz: c3e371c31cddcfce242dfcade11eedde48b7e5b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/friendly_id/base.rb
CHANGED
@@ -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.
|
224
|
+
relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name)
|
225
225
|
else
|
226
|
-
relation
|
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
|
-
|
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
|
data/lib/friendly_id/history.rb
CHANGED
@@ -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
|
6
|
-
t.integer
|
7
|
-
t.string
|
8
|
-
t.datetime
|
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
|
data/lib/friendly_id/scoped.rb
CHANGED
@@ -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.
|
142
|
+
memo.where(column => sluggable.send(column))
|
143
143
|
end
|
144
144
|
|
145
145
|
matched.first
|
data/lib/friendly_id/slug.rb
CHANGED
@@ -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.
|
61
|
-
scope = scope.
|
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.
|
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
|