friendly_id 3.0.0.beta3 → 3.0.0
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.
- data/Changelog.md +2 -5
- data/Rakefile +1 -1
- data/extras/extras.rb +1 -1
- data/lib/friendly_id.rb +1 -0
- data/lib/friendly_id/active_record.rb +8 -8
- data/lib/friendly_id/{acktive_record → active_record_adapter}/configuration.rb +5 -2
- data/lib/friendly_id/{acktive_record → active_record_adapter}/finders.rb +7 -5
- data/lib/friendly_id/{acktive_record → active_record_adapter}/simple_model.rb +4 -5
- data/lib/friendly_id/{acktive_record → active_record_adapter}/slug.rb +1 -1
- data/lib/friendly_id/{acktive_record → active_record_adapter}/slugged_model.rb +5 -6
- data/lib/friendly_id/{acktive_record → active_record_adapter}/tasks.rb +6 -6
- data/lib/friendly_id/finders.rb +6 -5
- data/lib/friendly_id/version.rb +1 -1
- data/test/{acktive_record → active_record_adapter}/basic_slugged_model_test.rb +3 -3
- data/test/{acktive_record → active_record_adapter}/cached_slug_test.rb +3 -3
- data/test/{acktive_record → active_record_adapter}/core.rb +1 -1
- data/test/{acktive_record → active_record_adapter}/custom_normalizer_test.rb +3 -3
- data/test/{acktive_record → active_record_adapter}/custom_table_name_test.rb +3 -3
- data/test/{acktive_record → active_record_adapter}/scoped_model_test.rb +2 -2
- data/test/{acktive_record → active_record_adapter}/simple_test.rb +2 -2
- data/test/{acktive_record → active_record_adapter}/slug_test.rb +0 -0
- data/test/{acktive_record → active_record_adapter}/slugged.rb +1 -1
- data/test/{acktive_record → active_record_adapter}/slugged_status_test.rb +1 -1
- data/test/{acktive_record → active_record_adapter}/sti_test.rb +3 -3
- data/test/active_record_adapter/support/database.jdbcsqlite3.yml +2 -0
- data/test/{acktive_record → active_record_adapter}/support/database.mysql.yml +0 -0
- data/test/{acktive_record → active_record_adapter}/support/database.postgres.yml +0 -0
- data/test/{acktive_record → active_record_adapter}/support/database.sqlite3.yml +0 -0
- data/test/{acktive_record → active_record_adapter}/support/models.rb +0 -0
- data/test/{acktive_record → active_record_adapter}/tasks_test.rb +1 -1
- data/test/{acktive_record → active_record_adapter}/test_helper.rb +1 -1
- metadata +37 -39
- data/test/acktive_record/temp_test.rb +0 -32
data/Changelog.md
CHANGED
@@ -6,15 +6,12 @@ suggestions, ideas and improvements to FriendlyId.
|
|
6
6
|
* Table of Contents
|
7
7
|
{:toc}
|
8
8
|
|
9
|
-
## 3.0.0 (
|
9
|
+
## 3.0.0 (2010-03-30)
|
10
10
|
|
11
11
|
* Rails 3 support.
|
12
12
|
* Removed features deprecated in FriendlyId 2.3.
|
13
|
-
|
14
|
-
## 2.3.5 (NOT RELEASED YET)
|
15
|
-
|
16
13
|
* Fixed searching by numeric friendly_id in non-slugged models.
|
17
|
-
* Added allow_nil option (Andre Duffeck and Norman Clarke)
|
14
|
+
* Added :allow_nil config option (Andre Duffeck and Norman Clarke)
|
18
15
|
|
19
16
|
## 2.3.4 (2010-03-22)
|
20
17
|
|
data/Rakefile
CHANGED
@@ -44,7 +44,7 @@ namespace :test do
|
|
44
44
|
sh "cd fid; rake test"
|
45
45
|
end
|
46
46
|
Rake::TestTask.new(:friendly_id) { |t| t.pattern = "test/*_test.rb" }
|
47
|
-
Rake::TestTask.new(:ar) { |t| t.pattern = "test/
|
47
|
+
Rake::TestTask.new(:ar) { |t| t.pattern = "test/active_record_adapter/*_test.rb" }
|
48
48
|
|
49
49
|
namespace :rails do
|
50
50
|
task :plugin do
|
data/extras/extras.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby -KU
|
2
2
|
require File.dirname(__FILE__) + '/../test/test_helper'
|
3
|
-
require File.dirname(__FILE__) + '/../test/
|
3
|
+
require File.dirname(__FILE__) + '/../test/active_record_adapter/test_helper'
|
4
4
|
require 'ffaker'
|
5
5
|
|
6
6
|
TIMES = (ENV['N'] || 100).to_i
|
data/lib/friendly_id.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module FriendlyId
|
2
2
|
|
3
|
-
module
|
3
|
+
module ActiveRecordAdapter
|
4
4
|
|
5
5
|
module Compat
|
6
6
|
def self.scope_method
|
@@ -41,12 +41,12 @@ module FriendlyId
|
|
41
41
|
end
|
42
42
|
|
43
43
|
class ActiveRecord::Base
|
44
|
-
extend FriendlyId::
|
44
|
+
extend FriendlyId::ActiveRecordAdapter
|
45
45
|
end
|
46
46
|
|
47
|
-
require File.join(File.dirname(__FILE__), "
|
48
|
-
require File.join(File.dirname(__FILE__), "
|
49
|
-
require File.join(File.dirname(__FILE__), "
|
50
|
-
require File.join(File.dirname(__FILE__), "
|
51
|
-
require File.join(File.dirname(__FILE__), "
|
52
|
-
require File.join(File.dirname(__FILE__), "
|
47
|
+
require File.join(File.dirname(__FILE__), "active_record_adapter", "configuration")
|
48
|
+
require File.join(File.dirname(__FILE__), "active_record_adapter", "finders")
|
49
|
+
require File.join(File.dirname(__FILE__), "active_record_adapter", "simple_model")
|
50
|
+
require File.join(File.dirname(__FILE__), "active_record_adapter", "slugged_model")
|
51
|
+
require File.join(File.dirname(__FILE__), "active_record_adapter", "slug")
|
52
|
+
require File.join(File.dirname(__FILE__), "active_record_adapter", "tasks")
|
@@ -1,13 +1,16 @@
|
|
1
1
|
module FriendlyId
|
2
|
-
module AcktiveRecord
|
3
2
|
|
3
|
+
module ActiveRecordAdapter
|
4
|
+
|
5
|
+
# Extends FriendlyId::Configuration with some implementation details and
|
6
|
+
# features specific to ActiveRecord.
|
4
7
|
class Configuration < FriendlyId::Configuration
|
5
8
|
|
6
9
|
# The column used to cache the friendly_id string. If no column is specified,
|
7
10
|
# FriendlyId will look for a column named +cached_slug+ and use it automatically
|
8
11
|
# if it exists. If for some reason you have a column named +cached_slug+
|
9
12
|
# but don't want FriendlyId to modify it, pass the option
|
10
|
-
# +:cache_column => false+ to {FriendlyId::
|
13
|
+
# +:cache_column => false+ to {FriendlyId::ActiveRecordAdapter#has_friendly_id has_friendly_id}.
|
11
14
|
attr_accessor :cache_column
|
12
15
|
|
13
16
|
# An array of classes for which the configured class serves as a
|
@@ -2,7 +2,7 @@ module FriendlyId
|
|
2
2
|
|
3
3
|
# The adapter for Ruby on Rails's ActiveRecord. Compatible with AR 2.2.x -
|
4
4
|
# 2.3.x.
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
|
7
7
|
# The classes in this module are used internally by FriendlyId, and exist
|
8
8
|
# largely to avoid polluting the ActiveRecord models with too many
|
@@ -16,22 +16,22 @@ module FriendlyId
|
|
16
16
|
# a cached or uncached finder.
|
17
17
|
class FinderProxy
|
18
18
|
|
19
|
+
extend Forwardable
|
20
|
+
|
19
21
|
attr_reader :finder
|
20
22
|
attr :finder_class
|
21
23
|
attr :ids
|
22
24
|
attr :model_class
|
23
25
|
attr :options
|
24
26
|
|
27
|
+
def_delegators :finder, :find, :unfriendly?
|
28
|
+
|
25
29
|
def initialize(model_class, *args, &block)
|
26
30
|
@model_class = model_class
|
27
31
|
@ids = args.shift
|
28
32
|
@options = args.first.kind_of?(Hash) ? args.first : {}
|
29
33
|
end
|
30
34
|
|
31
|
-
def method_missing(symbol, *args)
|
32
|
-
finder.send(symbol, *args)
|
33
|
-
end
|
34
|
-
|
35
35
|
# Perform the find query.
|
36
36
|
def finder
|
37
37
|
@finder ||= finder_class.new(ids, model_class, options)
|
@@ -85,6 +85,8 @@ module FriendlyId
|
|
85
85
|
# @abstract
|
86
86
|
module Multiple
|
87
87
|
|
88
|
+
include FriendlyId::Finders::Base
|
89
|
+
|
88
90
|
attr_reader :friendly_ids, :results, :unfriendly_ids
|
89
91
|
|
90
92
|
def initialize(ids, model_class, options={})
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module FriendlyId
|
2
|
-
module
|
2
|
+
module ActiveRecordAdapter
|
3
3
|
|
4
4
|
module SimpleModel
|
5
5
|
|
@@ -20,8 +20,7 @@ module FriendlyId
|
|
20
20
|
|
21
21
|
class MultipleFinder
|
22
22
|
|
23
|
-
include FriendlyId::Finders::
|
24
|
-
include FriendlyId::AcktiveRecord::Finders::Multiple
|
23
|
+
include FriendlyId::ActiveRecordAdapter::Finders::Multiple
|
25
24
|
include SimpleFinder
|
26
25
|
|
27
26
|
def find
|
@@ -71,7 +70,7 @@ module FriendlyId
|
|
71
70
|
validates_presence_of column, :unless => :skip_friendly_id_validations
|
72
71
|
validates_length_of column, :maximum => friendly_id_config.max_length, :unless => :skip_friendly_id_validations
|
73
72
|
after_update :update_scopes
|
74
|
-
extend FriendlyId::
|
73
|
+
extend FriendlyId::ActiveRecordAdapter::FinderMethods
|
75
74
|
end
|
76
75
|
end
|
77
76
|
|
@@ -109,7 +108,7 @@ module FriendlyId
|
|
109
108
|
end
|
110
109
|
|
111
110
|
def skip_friendly_id_validations
|
112
|
-
friendly_id.nil? &&
|
111
|
+
friendly_id.nil? && friendly_id_config.allow_nil?
|
113
112
|
end
|
114
113
|
|
115
114
|
def validate_friendly_id
|
@@ -5,7 +5,7 @@ class Slug < ::ActiveRecord::Base
|
|
5
5
|
belongs_to :sluggable, :polymorphic => true
|
6
6
|
before_save :enable_name_reversion, :set_sequence
|
7
7
|
validate :validate_name
|
8
|
-
send FriendlyId::
|
8
|
+
send FriendlyId::ActiveRecordAdapter::Compat.scope_method, :similar_to, lambda {|slug| {:conditions => {
|
9
9
|
:name => slug.name,
|
10
10
|
:scope => slug.scope,
|
11
11
|
:sluggable_type => slug.sluggable_type
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module FriendlyId
|
2
|
-
module
|
2
|
+
module ActiveRecordAdapter
|
3
3
|
module SluggedModel
|
4
4
|
|
5
5
|
module SluggedFinder
|
@@ -17,14 +17,13 @@ module FriendlyId
|
|
17
17
|
|
18
18
|
class MultipleFinder
|
19
19
|
|
20
|
-
include FriendlyId::Finders::
|
21
|
-
include FriendlyId::AcktiveRecord::Finders::Multiple
|
20
|
+
include FriendlyId::ActiveRecordAdapter::Finders::Multiple
|
22
21
|
include SluggedFinder
|
23
22
|
|
24
23
|
attr_reader :slugs
|
25
24
|
|
26
25
|
def find
|
27
|
-
@results =
|
26
|
+
@results = model_class.scoped(find_options).all(options).uniq
|
28
27
|
raise ::ActiveRecord::RecordNotFound, error_message if @results.size != expected_size
|
29
28
|
@results.each {|result| result.friendly_id_status.name = slug_for(result)}
|
30
29
|
end
|
@@ -146,7 +145,7 @@ module FriendlyId
|
|
146
145
|
after_update :update_scope
|
147
146
|
after_update :update_dependent_scopes
|
148
147
|
protect_friendly_id_attributes
|
149
|
-
extend FriendlyId::
|
148
|
+
extend FriendlyId::ActiveRecordAdapter::FinderMethods
|
150
149
|
end
|
151
150
|
end
|
152
151
|
|
@@ -156,7 +155,7 @@ module FriendlyId
|
|
156
155
|
slugs.find_by_name_and_sequence(name, sequence)
|
157
156
|
end
|
158
157
|
|
159
|
-
# The model instance's current {FriendlyId::
|
158
|
+
# The model instance's current {FriendlyId::ActiveRecordAdapter::Slug slug}.
|
160
159
|
def slug
|
161
160
|
return @slug if new_record?
|
162
161
|
@slug ||= slugs.first(:order => "id DESC")
|
@@ -1,10 +1,14 @@
|
|
1
1
|
module FriendlyId
|
2
2
|
class TaskRunner
|
3
3
|
|
4
|
+
extend Forwardable
|
5
|
+
|
4
6
|
attr_accessor :days
|
5
7
|
attr_accessor :klass
|
6
8
|
attr_accessor :task_options
|
7
9
|
|
10
|
+
def_delegators :klass, :find, :friendly_id_config, :update_all
|
11
|
+
|
8
12
|
OLD_SLUG_DAYS = 45
|
9
13
|
|
10
14
|
def initialize(&block)
|
@@ -12,16 +16,12 @@ module FriendlyId
|
|
12
16
|
self.days = ENV["DAYS"]
|
13
17
|
end
|
14
18
|
|
15
|
-
def method_missing(*args)
|
16
|
-
klass.send(*args)
|
17
|
-
end
|
18
|
-
|
19
19
|
def days=(days)
|
20
|
-
@days
|
20
|
+
@days ||= days.blank? ? OLD_SLUG_DAYS : days.to_i
|
21
21
|
end
|
22
22
|
|
23
23
|
def klass=(klass)
|
24
|
-
@klass
|
24
|
+
@klass ||= klass.to_s.classify.constantize unless klass.blank?
|
25
25
|
end
|
26
26
|
|
27
27
|
def make_slugs
|
data/lib/friendly_id/finders.rb
CHANGED
@@ -4,6 +4,11 @@ module FriendlyId
|
|
4
4
|
|
5
5
|
module Base
|
6
6
|
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
def_delegators :model_class, :base_class, :friendly_id_config,
|
10
|
+
:primary_key, :quoted_table_name, :sanitize_sql, :table_name
|
11
|
+
|
7
12
|
# Is the id friendly or numeric? Not that the return value here is
|
8
13
|
# +false+ if the +id+ is definitely not friendly, and +nil+ if it can
|
9
14
|
# not be determined.
|
@@ -38,10 +43,6 @@ module FriendlyId
|
|
38
43
|
self.scope = options.delete :scope
|
39
44
|
end
|
40
45
|
|
41
|
-
def method_missing(*args, &block)
|
42
|
-
model_class.send(*args, &block)
|
43
|
-
end
|
44
|
-
|
45
46
|
# An array of ids; can be both friendly and unfriendly.
|
46
47
|
attr_accessor :ids
|
47
48
|
|
@@ -105,4 +106,4 @@ module FriendlyId
|
|
105
106
|
end
|
106
107
|
|
107
108
|
end
|
108
|
-
end
|
109
|
+
end
|
data/lib/friendly_id/version.rb
CHANGED
@@ -2,12 +2,12 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
module FriendlyId
|
4
4
|
module Test
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
class BasicSluggedModelTest < ::Test::Unit::TestCase
|
7
7
|
include FriendlyId::Test::Generic
|
8
8
|
include FriendlyId::Test::Slugged
|
9
|
-
include FriendlyId::Test::
|
10
|
-
include FriendlyId::Test::
|
9
|
+
include FriendlyId::Test::ActiveRecordAdapter::Slugged
|
10
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -2,14 +2,14 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
module FriendlyId
|
4
4
|
module Test
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
|
7
7
|
class CachedSlugTest < ::Test::Unit::TestCase
|
8
8
|
|
9
9
|
include FriendlyId::Test::Generic
|
10
10
|
include FriendlyId::Test::Slugged
|
11
|
-
include FriendlyId::Test::
|
12
|
-
include FriendlyId::Test::
|
11
|
+
include FriendlyId::Test::ActiveRecordAdapter::Slugged
|
12
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
13
13
|
|
14
14
|
def klass
|
15
15
|
District
|
@@ -2,12 +2,12 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
module FriendlyId
|
4
4
|
module Test
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
|
7
7
|
class CustomNormalizerTest < ::Test::Unit::TestCase
|
8
8
|
|
9
|
-
include FriendlyId::Test::
|
10
|
-
include FriendlyId::Test::
|
9
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
10
|
+
include FriendlyId::Test::ActiveRecordAdapter::Slugged
|
11
11
|
include FriendlyId::Test::CustomNormalizer
|
12
12
|
|
13
13
|
def klass
|
@@ -2,14 +2,14 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
module FriendlyId
|
4
4
|
module Test
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
|
7
7
|
class CustomTableNameTest < ::Test::Unit::TestCase
|
8
8
|
|
9
9
|
include FriendlyId::Test::Generic
|
10
10
|
include FriendlyId::Test::Slugged
|
11
|
-
include FriendlyId::Test::
|
12
|
-
include FriendlyId::Test::
|
11
|
+
include FriendlyId::Test::ActiveRecordAdapter::Slugged
|
12
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
13
13
|
|
14
14
|
def klass
|
15
15
|
Place
|
@@ -7,8 +7,8 @@ module FriendlyId
|
|
7
7
|
|
8
8
|
include FriendlyId::Test::Generic
|
9
9
|
include FriendlyId::Test::Slugged
|
10
|
-
include FriendlyId::Test::
|
11
|
-
include FriendlyId::Test::
|
10
|
+
include FriendlyId::Test::ActiveRecordAdapter::Slugged
|
11
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
12
12
|
|
13
13
|
def setup
|
14
14
|
@user = User.create!(:name => "john")
|
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
module FriendlyId
|
4
4
|
module Test
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
module Simple
|
7
7
|
|
8
8
|
module SimpleTest
|
@@ -23,7 +23,7 @@ module FriendlyId
|
|
23
23
|
|
24
24
|
include FriendlyId::Test::Generic
|
25
25
|
include FriendlyId::Test::Simple
|
26
|
-
include FriendlyId::Test::
|
26
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
27
27
|
include SimpleTest
|
28
28
|
|
29
29
|
test "should default to not friendly" do
|
File without changes
|
@@ -2,14 +2,14 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
3
3
|
module FriendlyId
|
4
4
|
module Test
|
5
|
-
module
|
5
|
+
module ActiveRecordAdapter
|
6
6
|
|
7
7
|
class StiTest < ::Test::Unit::TestCase
|
8
8
|
|
9
9
|
include FriendlyId::Test::Generic
|
10
10
|
include FriendlyId::Test::Slugged
|
11
|
-
include FriendlyId::Test::
|
12
|
-
include FriendlyId::Test::
|
11
|
+
include FriendlyId::Test::ActiveRecordAdapter::Slugged
|
12
|
+
include FriendlyId::Test::ActiveRecordAdapter::Core
|
13
13
|
|
14
14
|
def klass
|
15
15
|
Novel
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -80,7 +80,7 @@ end
|
|
80
80
|
# A model that uses default slug settings and has a named scope
|
81
81
|
class Post < ActiveRecord::Base
|
82
82
|
has_friendly_id :name, :use_slug => true
|
83
|
-
send FriendlyId::
|
83
|
+
send FriendlyId::ActiveRecordAdapter::Compat.scope_method, :published, :conditions => { :published => true }
|
84
84
|
end
|
85
85
|
|
86
86
|
# Model that uses a custom table name
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 3
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 3.0.0.beta3
|
9
|
+
version: 3.0.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Norman Clarke
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2010-03-
|
19
|
+
date: 2010-03-30 00:00:00 -03:00
|
21
20
|
default_executable:
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
@@ -58,13 +57,13 @@ extensions: []
|
|
58
57
|
extra_rdoc_files: []
|
59
58
|
|
60
59
|
files:
|
61
|
-
- lib/friendly_id/acktive_record/configuration.rb
|
62
|
-
- lib/friendly_id/acktive_record/finders.rb
|
63
|
-
- lib/friendly_id/acktive_record/simple_model.rb
|
64
|
-
- lib/friendly_id/acktive_record/slug.rb
|
65
|
-
- lib/friendly_id/acktive_record/slugged_model.rb
|
66
|
-
- lib/friendly_id/acktive_record/tasks.rb
|
67
60
|
- lib/friendly_id/active_record.rb
|
61
|
+
- lib/friendly_id/active_record_adapter/configuration.rb
|
62
|
+
- lib/friendly_id/active_record_adapter/finders.rb
|
63
|
+
- lib/friendly_id/active_record_adapter/simple_model.rb
|
64
|
+
- lib/friendly_id/active_record_adapter/slug.rb
|
65
|
+
- lib/friendly_id/active_record_adapter/slugged_model.rb
|
66
|
+
- lib/friendly_id/active_record_adapter/tasks.rb
|
68
67
|
- lib/friendly_id/configuration.rb
|
69
68
|
- lib/friendly_id/finders.rb
|
70
69
|
- lib/friendly_id/railtie.rb
|
@@ -86,24 +85,24 @@ files:
|
|
86
85
|
- rails/init.rb
|
87
86
|
- generators/friendly_id/friendly_id_generator.rb
|
88
87
|
- generators/friendly_id/templates/create_slugs.rb
|
89
|
-
- test/
|
90
|
-
- test/
|
91
|
-
- test/
|
92
|
-
- test/
|
93
|
-
- test/
|
94
|
-
- test/
|
95
|
-
- test/
|
96
|
-
- test/
|
97
|
-
- test/
|
98
|
-
- test/
|
99
|
-
- test/
|
100
|
-
- test/
|
101
|
-
- test/
|
102
|
-
- test/
|
103
|
-
- test/
|
104
|
-
- test/
|
105
|
-
- test/
|
106
|
-
- test/
|
88
|
+
- test/active_record_adapter/basic_slugged_model_test.rb
|
89
|
+
- test/active_record_adapter/cached_slug_test.rb
|
90
|
+
- test/active_record_adapter/core.rb
|
91
|
+
- test/active_record_adapter/custom_normalizer_test.rb
|
92
|
+
- test/active_record_adapter/custom_table_name_test.rb
|
93
|
+
- test/active_record_adapter/scoped_model_test.rb
|
94
|
+
- test/active_record_adapter/simple_test.rb
|
95
|
+
- test/active_record_adapter/slug_test.rb
|
96
|
+
- test/active_record_adapter/slugged.rb
|
97
|
+
- test/active_record_adapter/slugged_status_test.rb
|
98
|
+
- test/active_record_adapter/sti_test.rb
|
99
|
+
- test/active_record_adapter/support/database.jdbcsqlite3.yml
|
100
|
+
- test/active_record_adapter/support/database.mysql.yml
|
101
|
+
- test/active_record_adapter/support/database.postgres.yml
|
102
|
+
- test/active_record_adapter/support/database.sqlite3.yml
|
103
|
+
- test/active_record_adapter/support/models.rb
|
104
|
+
- test/active_record_adapter/tasks_test.rb
|
105
|
+
- test/active_record_adapter/test_helper.rb
|
107
106
|
- test/friendly_id_test.rb
|
108
107
|
- test/slug_string_test.rb
|
109
108
|
- test/test_helper.rb
|
@@ -146,16 +145,15 @@ signing_key:
|
|
146
145
|
specification_version: 3
|
147
146
|
summary: A comprehensive slugging and pretty-URL plugin.
|
148
147
|
test_files:
|
149
|
-
- test/
|
150
|
-
- test/
|
151
|
-
- test/
|
152
|
-
- test/
|
153
|
-
- test/
|
154
|
-
- test/
|
155
|
-
- test/
|
156
|
-
- test/
|
157
|
-
- test/
|
158
|
-
- test/
|
159
|
-
- test/acktive_record/temp_test.rb
|
148
|
+
- test/active_record_adapter/basic_slugged_model_test.rb
|
149
|
+
- test/active_record_adapter/cached_slug_test.rb
|
150
|
+
- test/active_record_adapter/custom_normalizer_test.rb
|
151
|
+
- test/active_record_adapter/custom_table_name_test.rb
|
152
|
+
- test/active_record_adapter/scoped_model_test.rb
|
153
|
+
- test/active_record_adapter/simple_test.rb
|
154
|
+
- test/active_record_adapter/slug_test.rb
|
155
|
+
- test/active_record_adapter/slugged_status_test.rb
|
156
|
+
- test/active_record_adapter/sti_test.rb
|
157
|
+
- test/active_record_adapter/tasks_test.rb
|
160
158
|
- test/friendly_id_test.rb
|
161
159
|
- test/slug_string_test.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
|
3
|
-
|
4
|
-
# scope :hello, :conditions => {"books.name" => "hello world"}
|
5
|
-
# scope :friendly, lambda { |name| {:conditions => {"slugs.name" => name }, :include => :slugs}}
|
6
|
-
#
|
7
|
-
# def self.find(*args, &block)
|
8
|
-
# if FriendlyId::Finders::Base.friendly?(args.first)
|
9
|
-
# puts "doing friendly find with #{args.first}"
|
10
|
-
# self.friendly(args.shift).first(*args)
|
11
|
-
# else
|
12
|
-
# super
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# end
|
17
|
-
|
18
|
-
module FriendlyId
|
19
|
-
module Test
|
20
|
-
module AcktiveRecord
|
21
|
-
|
22
|
-
class StiTest < ::Test::Unit::TestCase
|
23
|
-
|
24
|
-
# def test_temp
|
25
|
-
# instance = Post.create(:name => "hello world")
|
26
|
-
# p instance.class.find(instance.friendly_id)
|
27
|
-
# end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|