friendly_id 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 2.1.3 2009-06-03
2
+
3
+ * 1 minor enhancement:
4
+ * Always call #to_s on slug_text to allow objects such as DateTimes to be used for the friendly_id text. (reported by Jon Ng)
5
+
1
6
  == 2.1.2 2009-05-21
2
7
 
3
8
  * 2 minor enhancements:
data/Manifest.txt CHANGED
@@ -24,6 +24,7 @@ test/contest.rb
24
24
  test/custom_slug_normalizer_test.rb
25
25
  test/models/book.rb
26
26
  test/models/country.rb
27
+ test/models/event.rb
27
28
  test/models/novel.rb
28
29
  test/models/person.rb
29
30
  test/models/post.rb
data/friendly_id.gemspec CHANGED
@@ -2,15 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{friendly_id}
5
- s.version = "2.1.2"
6
-
5
+ s.version = "2.1.3"
7
6
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
7
  s.authors = ["Norman Clarke", "Adrian Mugnolo", "Emilio Tagua"]
9
- s.date = %q{2009-05-21}
8
+ s.date = %q{2009-06-03}
10
9
  s.description = %q{A comprehensive slugging and pretty-URL plugin for ActiveRecord.}
11
10
  s.email = ["norman@rubysouth.com", "adrian@rubysouth.com", "miloops@gmail.com"]
12
11
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
13
- s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "config/website.yml", "friendly_id.gemspec", "generators/friendly_id/friendly_id_generator.rb", "generators/friendly_id/templates/create_slugs.rb", "generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb", "generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb", "init.rb", "lib/friendly_id.rb", "lib/friendly_id/helpers.rb", "lib/friendly_id/non_sluggable_class_methods.rb", "lib/friendly_id/non_sluggable_instance_methods.rb", "lib/friendly_id/slug.rb", "lib/friendly_id/sluggable_class_methods.rb", "lib/friendly_id/sluggable_instance_methods.rb", "lib/friendly_id/version.rb", "lib/tasks/friendly_id.rake", "lib/tasks/friendly_id.rb", "test/contest.rb", "test/custom_slug_normalizer_test.rb", "test/models/book.rb", "test/models/country.rb", "test/models/novel.rb", "test/models/person.rb", "test/models/post.rb", "test/models/thing.rb", "test/models/user.rb", "test/non_slugged_test.rb", "test/schema.rb", "test/scoped_model_test.rb", "test/slug_test.rb", "test/slugged_model_test.rb", "test/sti_test.rb", "test/test_helper.rb"]
12
+ s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "config/website.yml", "friendly_id.gemspec", "generators/friendly_id/friendly_id_generator.rb", "generators/friendly_id/templates/create_slugs.rb", "generators/friendly_id_20_upgrade/friendly_id_20_upgrade_generator.rb", "generators/friendly_id_20_upgrade/templates/upgrade_friendly_id_to_20.rb", "init.rb", "lib/friendly_id.rb", "lib/friendly_id/helpers.rb", "lib/friendly_id/non_sluggable_class_methods.rb", "lib/friendly_id/non_sluggable_instance_methods.rb", "lib/friendly_id/slug.rb", "lib/friendly_id/sluggable_class_methods.rb", "lib/friendly_id/sluggable_instance_methods.rb", "lib/friendly_id/version.rb", "lib/tasks/friendly_id.rake", "lib/tasks/friendly_id.rb", "test/contest.rb", "test/custom_slug_normalizer_test.rb", "test/models/book.rb", "test/models/country.rb", "test/models/event.rb", "test/models/novel.rb", "test/models/person.rb", "test/models/post.rb", "test/models/thing.rb", "test/models/user.rb", "test/non_slugged_test.rb", "test/schema.rb", "test/scoped_model_test.rb", "test/slug_test.rb", "test/slugged_model_test.rb", "test/sti_test.rb", "test/test_helper.rb"]
14
13
  s.homepage = %q{http://friendly-id.rubyforge.org/}
15
14
  s.rdoc_options = ["--main", "README.rdoc"]
16
15
  s.require_paths = ["lib"]
@@ -34,7 +34,7 @@ class Slug < ActiveRecord::Base
34
34
  # better urls in your application.
35
35
  def normalize(slug_text)
36
36
  return "" if slug_text.nil? || slug_text == ""
37
- ActiveSupport::Multibyte.proxy_class.new(slug_text).normalize(:kc).
37
+ ActiveSupport::Multibyte.proxy_class.new(slug_text.to_s).normalize(:kc).
38
38
  # For some reason Spanish ¡ and ¿ are not detected as non-word
39
39
  # characters. Bug in Ruby?
40
40
  gsub(/[\W|¡|¿]/u, ' ').
@@ -2,7 +2,7 @@ module FriendlyId #:nodoc:
2
2
  module Version #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 1
5
- TINY = 2
5
+ TINY = 3
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
@@ -0,0 +1,3 @@
1
+ class Event < ActiveRecord::Base
2
+ has_friendly_id :event_date, :use_slug => true
3
+ end
data/test/schema.rb CHANGED
@@ -32,6 +32,11 @@ ActiveRecord::Schema.define(:version => 1) do
32
32
  t.column "name", "string"
33
33
  end
34
34
 
35
+ create_table "events", :force => true do |t|
36
+ t.column "name", "string"
37
+ t.column "event_date", "datetime"
38
+ end
39
+
35
40
  create_table "slugs", :force => true do |t|
36
41
  t.column "name", "string"
37
42
  t.column "sluggable_id", "integer"
@@ -86,6 +86,10 @@ class SluggedModelTest < Test::Unit::TestCase
86
86
  assert_match(/--2\z/, @post2.friendly_id)
87
87
  end
88
88
 
89
+ should "allow datetime columns to be used as slugs" do
90
+ assert Event.create(:name => "Test", :event_date => DateTime.now)
91
+ end
92
+
89
93
  should "not strip diacritics" do
90
94
  @post = Post.new(:title => "¡Feliz año!")
91
95
  assert_match(/#{'ñ'}/, @post.slug_text)
data/test/test_helper.rb CHANGED
@@ -22,6 +22,7 @@ require 'models/country'
22
22
  require 'models/book'
23
23
  require 'models/novel'
24
24
  require 'models/thing'
25
+ require 'models/event'
25
26
 
26
27
  # Borrowed from ActiveSupport
27
28
  def silence_stream(stream)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -32,7 +32,7 @@ cert_chain:
32
32
  h7fbBRfStxI=
33
33
  -----END CERTIFICATE-----
34
34
 
35
- date: 2009-05-21 00:00:00 -03:00
35
+ date: 2009-06-03 00:00:00 -03:00
36
36
  default_executable:
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
@@ -125,6 +125,7 @@ files:
125
125
  - test/custom_slug_normalizer_test.rb
126
126
  - test/models/book.rb
127
127
  - test/models/country.rb
128
+ - test/models/event.rb
128
129
  - test/models/novel.rb
129
130
  - test/models/person.rb
130
131
  - test/models/post.rb
metadata.gz.sig CHANGED
Binary file