Displaying 3 results from an estimated 3 matches for "sanitize_conditions".
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2004 Dec 07
30
Bind Variables in Active Record
OK, I have some basic functionality to support bind variables, it
appears to work with the ''old'' %s style too.
I''ve altered sanitize_conditions in
activerecord/lib/active_record/base.rb to check whether bind variables
are in the statement (/\?/). If they are, replace all the ?s to
escaped values from the arguments array. else santize and expand.
There are a few gotchas with this simple approach:
1) ? in statements not meant for binding...
2006 Jul 24
7
[PATCH] Support for DB Clusters/Replication in ActiveRecord (RFC)
...end
# Returns true if the given +id+ represents the primary key of a record in the database, false otherwise.
@@ -506,7 +506,7 @@
# Product.count_by_sql "SELECT COUNT(*) FROM sales s, customers c WHERE s.customer_id = c.id"
def count_by_sql(sql)
sql = sanitize_conditions(sql)
- connection.select_value(sql, "#{name} Count").to_i
+ connection(:read).select_value(sql, "#{name} Count").to_i
end
# Increments the specified counter by one. So <tt>DiscussionBoard.increment_counter("post_count",
@@ -725,7 +72...