Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace example with SQL placeholder syntax.

This works just fine, is less code, and reduces the risk of someone implementing a SQL injection vulnerability.
  • Loading branch information...
commit 1c61365f8ebb161c6f0aed342c4eca6da86c4b28 1 parent cd14cbd
@tilsammans tilsammans authored vijaydev committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  railties/guides/source/association_basics.textile
View
2  railties/guides/source/association_basics.textile
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.