Skip to content

Commit

Permalink
Fix error message for find_by_sql method
Browse files Browse the repository at this point in the history
Also add test for `find_by_sql`.
  • Loading branch information
logicaltext authored and stephencelis committed Mar 25, 2010
1 parent 8d6f06e commit 940e03d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts_as_singleton.rb
Expand Up @@ -58,7 +58,7 @@ def find(*args)
def find_by_sql(sql)
unless caller.first.include?("lib/active_record")
raise NoMethodError,
"private method `find' called for #{inspect}"
"private method `find_by_sql' called for #{inspect}"
end
super # (:first) || create
end
Expand Down
1 change: 1 addition & 0 deletions test/acts_as_singleton_test.rb
Expand Up @@ -61,6 +61,7 @@ class ActsAsSingletonTest < ActiveSupport::TestCase
assert_raise(NoMethodError) { HomepageSettings.all }
assert_raise(NoMethodError) { HomepageSettings.first }
assert_raise(NoMethodError) { HomepageSettings.find }
assert_raise(NoMethodError) { HomepageSettings.find_by_sql("") }
assert_raise(NoMethodError) { HomepageSettings.named_scope }
assert_raise(NoMethodError) { HomepageSettings.minimum }
assert_raise(NoMethodError) { HomepageSettings.maximum }
Expand Down

0 comments on commit 940e03d

Please sign in to comment.