Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added errors when :scope argument is used.

  • Loading branch information...
commit 7e03359ee870283634b3ea053203470454511878 1 parent 0dba84c
Norman Clarke norman authored
10 lib/friendly_id/active_record_adapter/relation.rb
View
@@ -133,6 +133,14 @@ def validate_expected_size!(ids, result)
end
end
+ def apply_finder_options(options)
+ if options[:scope]
+ raise "The :scope finder option has been removed from FriendlyId 3.2.0 " +
+ "https://github.com/norman/friendly_id/issues#issue/88"
+ end
+ super
+ end
+
protected
def find_one(id)
@@ -154,4 +162,4 @@ def find_some(ids)
end
end
end
-end
+end
6 test/active_record_adapter/scoped_model_test.rb
View
@@ -26,6 +26,12 @@ def teardown
Tourist.delete_all
end
+ test "As of 3.2.0, should raise error if :scope option is passed" do
+ assert_raise(RuntimeError) do
+ Tourist.find("hello", :scope => "usa")
+ end
+ end
+
test "should not use cached slug column with scopes" do
@tourist = Tourist.create!(:name => "John Smith", :country => @usa)
@tourist2 = Tourist.create!(:name => "John Smith", :country => @canada)
Please sign in to comment.
Something went wrong with that request. Please try again.