Extract Sql From Active Record
Join the DZone community and get the full member experience.
Join For Free// This method extends ActiveRecord and return the sql generated
// For instance: City.view_sql(6) will return "select * from cities where id=6"
// you can use all ActiveRecord stuff (includes, order, conditions....)
module ActiveRecord
class Base
class << self
def view_sql(*args)
options = args.extract_options!
validate_find_options(options)
set_readonly_option!(options)
construct_finder_sql(options)
end
end
end
end
Record (computer science)
Extract
sql
Opinions expressed by DZone contributors are their own.
Comments