friendly_id 5.0.0.alpha.1 → 5.0.0.beta1

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.
@@ -1,3 +1,3 @@
1
1
  module FriendlyId
2
- VERSION = "5.0.0.alpha.1"
3
- end
2
+ VERSION = "5.0.0.beta1"
3
+ end
data/test/shared.rb CHANGED
@@ -101,6 +101,14 @@ module FriendlyId
101
101
  with_instance_of(model_class) {|record| assert model_class.friendly.find record.id.to_s}
102
102
  end
103
103
 
104
+ test "should treat numeric part of string as an integer id" do
105
+ with_instance_of(model_class) do |record|
106
+ assert_raises(ActiveRecord::RecordNotFound) do
107
+ model_class.friendly.find "#{record.id}-foo"
108
+ end
109
+ end
110
+ end
111
+
104
112
  test "should be findable by numeric friendly_id" do
105
113
  with_instance_of(model_class, :name => "206") {|record| assert model_class.friendly.find record.friendly_id}
106
114
  end
data/test/slugged_test.rb CHANGED
@@ -224,7 +224,7 @@ class UnderscoreAsSequenceSeparatorRegressionTest < MiniTest::Unit::TestCase
224
224
 
225
225
  end
226
226
 
227
- # https://github.com/FriendlyId/friendly_id/issues/148
227
+ # https://github.com/norman/friendly_id/issues/148
228
228
  class FailedValidationAfterUpdateRegressionTest < MiniTest::Unit::TestCase
229
229
  include FriendlyId::Test
230
230
 
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: 5.0.0.alpha.1
4
+ version: 5.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-01 00:00:00.000000000 Z
12
+ date: 2013-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -123,6 +123,20 @@ dependencies:
123
123
  - - '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: redcarpet
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
126
140
  description: |
127
141
  FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for
128
142
  Ruby on Rails. It allows you to create pretty URLs and work with human-friendly
@@ -138,13 +152,13 @@ files:
138
152
  - .gitignore
139
153
  - .travis.yml
140
154
  - .yardopts
155
+ - CONTRIBUTING.md
141
156
  - Changelog.md
142
157
  - Gemfile
143
- - Guide.rdoc
158
+ - Guide.md
144
159
  - MIT-LICENSE
145
160
  - README.md
146
161
  - Rakefile
147
- - WhatsNew.md
148
162
  - bench.rb
149
163
  - friendly_id.gemspec
150
164
  - gemfiles/Gemfile.rails-4.0.rb
@@ -153,12 +167,12 @@ files:
153
167
  - lib/friendly_id/base.rb
154
168
  - lib/friendly_id/candidates.rb
155
169
  - lib/friendly_id/configuration.rb
170
+ - lib/friendly_id/finders.rb
156
171
  - lib/friendly_id/history.rb
157
172
  - lib/friendly_id/migration.rb
158
173
  - lib/friendly_id/object_utils.rb
159
174
  - lib/friendly_id/reserved.rb
160
175
  - lib/friendly_id/scoped.rb
161
- - lib/friendly_id/scopes.rb
162
176
  - lib/friendly_id/simple_i18n.rb
163
177
  - lib/friendly_id/slug.rb
164
178
  - lib/friendly_id/slug_generator.rb
data/WhatsNew.md DELETED
@@ -1,3 +0,0 @@
1
- # What's New in FriendlyId 5?
2
-
3
- ## Write me
@@ -1,28 +0,0 @@
1
- module FriendlyId
2
- module Scopes
3
-
4
- def self.extended(model_class)
5
- model_class.scope :friendly, ->{model_class.all} do
6
- def find(*args)
7
- id = args.first
8
- return super if args.count != 1 || id.unfriendly_id?
9
- find_by_friendly_id(id) or super
10
- end
11
-
12
- def exists?(conditions = :none)
13
- return super if conditions.unfriendly_id? || conditions.unfriendly_id?.nil?
14
- exists_by_friendly_id?(conditions)
15
- end
16
- end
17
- end
18
-
19
- def find_by_friendly_id(id)
20
- where(friendly_id_config.query_field => id).first
21
- end
22
-
23
- def exists_by_friendly_id?(id)
24
- where(friendly_id_config.query_field => id).exists?
25
- end
26
-
27
- end
28
- end