public
Rubygem
Description: FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
Homepage: http://friendly-id.rubyforge.org
Clone URL: git://github.com/norman/friendly_id.git
Revert "Minor code maintenance on tests and README."

This reverts commit e4c615eb09c7209e168d98047a6347ef11ba6412.
norman (author)
Mon Jun 23 16:37:51 -0700 2008
commit  56a1ab7457f2845c7f37d052e2a5fd172b479627
tree    0f4c93fdf28486b1d8ee65ef72dbe9a048041638
parent  e4c615eb09c7209e168d98047a6347ef11ba6412
0
...
167
168
169
 
 
 
 
 
 
 
 
 
170
171
172
173
174
175
176
177
178
 
 
179
180
181
...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
 
 
 
185
186
187
188
189
0
@@ -167,15 +167,23 @@ rake:friendly_id:remove_old_slugs DAYS=60
0
 
0
 At the moment, Model.exists? fails when using the slug (reported by Chris Nolan).
0
 
0
+Finder options are ignored when using slugs; this code returns results when it should not:
0
+
0
+  Post.find_using_friendly_id(slugs(:one).name, :conditions => "1 = 2")
0
+
0
+This bug was reported by Dan Blue.
0
+
0
+These bugs part of a general pattern of not acting enough like
0
+ActiveRecord::Base, something I will address when I have a little more time.
0
+
0
 There probably are more bugs. If you find any, please contact the developers,
0
 or leave a comment at our site at: http://randomba.org.
0
 
0
 == Credits:
0
 
0
 Friendly_id was created by Norman Clarke
0
-(norman@randomba.org[mailto:norman@randomba.org]) and Adrian Mugnolo
0
-(adrian@randomba.org[mailto:adrian@randomba.org]), with significant contributions
0
-from Emilio Tagua (miloops@gmail.com[mailto:miloops@gmail.com]).
0
+(norman@addthree.com[mailto:norman@addthree.com]) and Adrian Mugnolo
0
+(adrian@giro54.com[mailto:adrian@giro54.com]).
0
 
0
 == Similar Plugins:
0
 
...
8
9
10
 
 
 
 
 
 
 
 
 
 
11
12
13
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
183
184
185
 
 
 
 
 
 
 
 
 
 
 
 
186
187
188
0
@@ -8,6 +8,16 @@ class SluggableTest < Test::Unit::TestCase
0
     Post.friendly_id_options[:max_length] = Post.default_friendly_id_options[:max_length]  
0
   end
0
   
0
+  # This test fails right now because this fix has not been implemented
0
+  # for sluggable models, only non-sluggable models. The failing test is here
0
+  # as a reminder to FIX THE CODE, but I don't have time to do it right now.
0
+  # The test is temporarily commented out so as not to break anybody's build.
0
+  # def test_finder_options_are_not_ignored
0
+  #   assert_raises ActiveRecord::RecordNotFound do
0
+  #     Post.find_using_friendly_id(slugs(:one).name, :conditions => "1 = 2")
0
+  #   end
0
+  # end
0
+
0
   def test_post_should_generate_friendly_id
0
    @post = Post.new(:name => "Test post", :content => "Test content")
0
    assert_equal "test-post", @post.generate_friendly_id
0
@@ -173,18 +183,6 @@ class SluggableTest < Test::Unit::TestCase
0
     assert !Post.find_using_friendly_id(slugs(:one).name, :conditions => "1 = 2")
0
   end
0
 
0
-  def test_finder_options_are_not_ignored
0
-    assert_raises ActiveRecord::RecordNotFound do
0
-      Post.find(slugs(:one).name, :conditions => "1 = 2")
0
-    end
0
-  end
0
-  
0
-  # This tests is commented out because at the moment this feature is not
0
-  # supported. The test is a reminder to implement it!.
0
-  # def test_exists_works
0
-  #   assert Post.exists?(slugs(:one).name)
0
-  # end
0
-
0
   def test_should_find_post_using_slugs_with_conditions
0
     assert_equal posts(:with_one_slug), Post.find_using_friendly_id(slugs(:one).name, :conditions => "1 = 1")
0
   end

Comments