slugs 1.2.5 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/records_test.rb CHANGED
@@ -16,42 +16,42 @@ class RecordsTest < ActiveSupport::TestCase
16
16
 
17
17
  test 'slug creation' do
18
18
  assert_equal 'name', simple.slug
19
- assert_equal simple, Simple.find('name')
19
+ assert_equal simple, Simple.slugged.find('name')
20
20
 
21
21
  assert_equal 'translatable-name', translatable.slug
22
- assert_equal translatable, Translatable.find('translatable-name')
22
+ assert_equal translatable, Translatable.slugged.find('translatable-name')
23
23
  end
24
24
 
25
25
  test 'slug edition' do
26
26
  simple.name = 'new name'
27
27
  simple.save!
28
28
  assert_equal 'new-name', simple.slug
29
- assert_equal simple, Simple.find('new-name')
29
+ assert_equal simple, Simple.slugged.find('new-name')
30
30
 
31
31
  translatable.name = 'new translatable name'
32
32
  translatable.save!
33
33
  assert_equal 'new-translatable-name', translatable.slug
34
- assert_equal translatable, Translatable.find('new-translatable-name')
34
+ assert_equal translatable, Translatable.slugged.find('new-translatable-name')
35
35
  end
36
36
 
37
37
  test 'direct assigned slug' do
38
38
  simple.slug = 'direct slug'
39
39
  simple.save!
40
40
  assert_equal 'direct slug', simple.slug
41
- assert_equal simple, Simple.find('direct slug')
41
+ assert_equal simple, Simple.slugged.find('direct slug')
42
42
 
43
43
  translatable.slug = 'translatable direct slug'
44
44
  translatable.save!
45
45
  assert_equal 'translatable direct slug', translatable.slug
46
- assert_equal translatable, Translatable.find('translatable direct slug')
46
+ assert_equal translatable, Translatable.slugged.find('translatable direct slug')
47
47
  end
48
48
 
49
49
  test 'not readonly records' do
50
50
  Simple.create! name: 'editable'
51
- assert !Simple.find('editable').readonly?
51
+ assert !Simple.slugged.find('editable').readonly?
52
52
 
53
53
  Translatable.create! name: 'editable'
54
- assert !Translatable.find('editable').readonly?
54
+ assert !Translatable.slugged.find('editable').readonly?
55
55
  end
56
56
 
57
57
  test 'index assignment to equal slugs' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-27 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,8 +16,8 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.0
20
- - - "<"
19
+ version: 4.0.0
20
+ - - "<="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 4.2.0
23
23
  type: :runtime
@@ -26,8 +26,8 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 3.1.0
30
- - - "<"
29
+ version: 4.0.0
30
+ - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.2.0
33
33
  - !ruby/object:Gem::Dependency
@@ -37,6 +37,9 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.4
40
43
  type: :development
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,6 +47,9 @@ dependencies:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
49
  version: '1.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.4
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: sqlite3
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -70,8 +76,8 @@ files:
70
76
  - Rakefile
71
77
  - lib/slugs.rb
72
78
  - lib/slugs/active_record/base.rb
79
+ - lib/slugs/active_record/finders.rb
73
80
  - lib/slugs/active_record/non_translatable.rb
74
- - lib/slugs/active_record/relation.rb
75
81
  - lib/slugs/active_record/translatable.rb
76
82
  - lib/slugs/railtie.rb
77
83
  - lib/slugs/version.rb
@@ -139,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
145
  version: '0'
140
146
  requirements: []
141
147
  rubyforge_project:
142
- rubygems_version: 2.2.2
148
+ rubygems_version: 2.4.5
143
149
  signing_key:
144
150
  specification_version: 4
145
151
  summary: Slugs for rails.
@@ -1,16 +0,0 @@
1
- module Slugs
2
- module ActiveRecord
3
- module Relation
4
- extend ActiveSupport::Concern
5
-
6
- def find_one(id)
7
- (sluggable? and id.is_a? String) ? (find_by_slug(id) || super) : super
8
- end
9
-
10
- def exists?(id=false)
11
- (sluggable? and id.is_a? String) ? (exists_by_slug(id) || super) : super
12
- end
13
-
14
- end
15
- end
16
- end