How to copy model with arel_table instance

23 views
Skip to first unread message

Тіма Маслюченко

unread,
Sep 19, 2012, 12:49:49 PM9/19/12
to rubyonra...@googlegroups.com
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 scoped.dup then i get error, because i changed table_alias and rest of queries use that arel_table for request
Reply all
Reply to author
Forward
0 new messages