mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Replace example with SQL placeholder syntax.
This works just fine, is less code, and reduces the risk of someone implementing a SQL injection vulnerability.
This commit is contained in:
@@ -1234,7 +1234,7 @@ If you need to evaluate conditions dynamically at runtime, use a proc:
|
||||
<ruby>
|
||||
class Customer < ActiveRecord::Base
|
||||
has_many :latest_orders, :class_name => "Order",
|
||||
:conditions => proc { "orders.created_at > #{10.hours.ago.to_s(:db).inspect}" }
|
||||
:conditions => proc { ["orders.created_at > ?, 10.hours.ago] }
|
||||
end
|
||||
</ruby>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user