提交 76e4c1a5 编写于 作者: J Jeremy Kemper

r1294@iwill: jeremy | 2005-06-13 02:17:42 -0700

 Ticket #1281
 r1295@iwill:  jeremy | 2005-06-13 02:50:50 -0700
 Apply patch, tweak, and test.
 r1296@iwill:  jeremy | 2005-06-13 02:51:04 -0700
 Changelog entry.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1410 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 fa7f4a06
*SVN*
* Fixed sanitized conditions for has_many finder method. #1281 [jackc@hylesanderson.com, pragdave, Tobias Luetke]
* Comprehensive PostgreSQL schema support. Use the optional schema_search_path directive in database.yml to give a comma-separated list of schemas to search for your tables. This allows you, for example, to have tables in a shared schema without having to use a custom table name. See http://www.postgresql.org/docs/8.0/interactive/ddl-schemas.html to learn more. #827 [dave@cherryville.org]
* Corrected @@configurations typo #1410 [david@ruppconsulting.com]
......
......@@ -66,7 +66,9 @@ def find(*args)
load_target.select { |record| ids.include?(record.id) }
end
else
options[:conditions] = @finder_sql + (options[:conditions] ? " AND #{options[:conditions]}" : "")
if options[:conditions] = sanitize_sql(options[:conditions])
options[:conditions] = "#{@finder_sql} AND #{options[:conditions]}"
end
if options[:order] && @options[:order]
options[:order] = "#{options[:order]}, #{@options[:order]}"
......
......@@ -345,16 +345,25 @@ def test_find_all
def test_find_all_sanitized
firm = Firm.find_first
assert_equal firm.clients.find_all("name = 'Summit'"), firm.clients.find_all(["name = '%s'", "Summit"])
summit = firm.clients.find(:all, :conditions => "name = 'Summit'")
assert_equal summit, firm.clients.find(:all, :conditions => ["name = ?", "Summit"])
assert_equal summit, firm.clients.find(:all, :conditions => ["name = :name", { :name => "Summit" }])
end
def test_find_first
firm = Firm.find_first
client2 = Client.find(2)
assert_equal firm.clients.first, firm.clients.find_first
assert_equal Client.find(2), firm.clients.find_first("type = 'Client'")
assert_equal client2, firm.clients.find_first("type = 'Client'")
assert_equal client2, firm.clients.find(:first, :conditions => "type = 'Client'")
end
def test_find_first_sanitized
assert_equal Client.find(2), Firm.find_first.clients.find_first(["type = ?", "Client"])
firm = Firm.find_first
client2 = Client.find(2)
assert_equal client2, firm.clients.find_first(["type = ?", "Client"])
assert_equal client2, firm.clients.find(:first, :conditions => ['type = ?', 'Client'])
assert_equal client2, firm.clients.find(:first, :conditions => ['type = :type', { :type => 'Client' }])
end
def test_find_in_collection
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册