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 "Allow friendly_id to accept conditions when using slugs."

This reverts commit 09382b50e388a0b6c06915382977ddfe98dc3c79.
norman (author)
Mon Jun 23 16:39:26 -0700 2008
commit  38f23b8d6507cdd5892fece9787953a5093868d6
tree    1c9cd06ce83589590372325f979fa0a2c1458043
parent  d917a682f57c62816807325a2b18998f12cd5cb3
...
134
135
136
137
138
 
139
140
 
141
142
 
143
144
145
...
134
135
136
 
 
137
138
 
139
140
 
141
142
143
144
0
@@ -134,12 +134,11 @@ module Randomba
0
       # returns false. When given as an array will try to find any of the
0
       # records and return those that can be found.
0
       def find_using_friendly_id(*args)
0
-        kind = args.shift
0
-        case kind
0
+        case args.first
0
           when String
0
-            slugs = Slug.find_by_name_and_sluggable_type(kind, self.to_s, args.first)
0
+            slugs = Slug.find_by_name_and_sluggable_type(args.first, self.to_s)
0
           when Array
0
-            slugs = Slug.find_all_by_name_and_sluggable_type(kind, self.to_s, args.first)
0
+            slugs = Slug.find_all_by_name_and_sluggable_type(args.first, self.to_s)
0
           else
0
             return false
0
         end
...
179
180
181
182
183
184
185
186
187
188
189
190
...
179
180
181
 
 
 
 
 
 
 
182
183
0
@@ -179,11 +179,4 @@ class SluggableTest < Test::Unit::TestCase
0
     end
0
   end
0
 
0
-  def test_should_not_find_post_using_slugs_with_invalid_conditions
0
-    assert !Post.find_using_friendly_id(slugs(:one).name, :conditions => "1 = 2")
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
0
 end
0
\ No newline at end of file

Comments