Displaying 2 results from an estimated 2 matches for "table_alias".
2012 Sep 19
0
How to copy model with arel_table instance
Hi all
I want to make copy of current scoped object, then change some stuff in
arel_table(i need to change table_alias, because i have complicated query)
and arel(SelectManager)
def self.do_smth
query = scoped.dup
puts query.arel_table.object_id == scoped.arel_table.object_id # true
end
Theoretically i can dup arel(SelectManager) but i can not find how to add
table alias to that instance
If i do this with...
2011 Nov 22
4
A "strict Arel" mode for ActiveRecord to prevent SQL injection vulnerabilities
...d_at: "2011-10-26
22:01:36", updated_at: "2011-10-26 22:24:40">
* Custom Arel-based queries work:
ruby-1.9.2-p290 :005 > t = Customer.arel_table
=> #<Arel::Table:0x000000026da950 @name="customers",
@engine=ActiveRecord::Base, @columns=nil, @aliases=[], @table_alias=nil,
@primary_key=nil>
ruby-1.9.2-p290 :022 > Customer.where(t[:name].eq(''BooBaz''))
Customer Load (0.3ms) SELECT `customers`.* FROM `customers` WHERE
`customers`.`name` = ''BooBaz''
=> [#<Customer id: 3, name: "BooBaz", credit: "baz&q...