ruby on rails - Arel, nested NamedFunction -


i'm trying compose query via arel:

select round(unix_timestamp(curtime(4)) * 1000) table1 

using http://www.scuttle.io/ return simply:

table1.select(   arel::nodes::namedfunction.new(     'round', [       arel::nodes::namedfunction.new(         'unix_timestamp', [arel::nodes::namedfunction.new('curtime', [4])]       ) * 1000     ]   ) ) 

but rails app doesn't accept it, giving me:

nomethoderror (undefined method `*' #<arel::nodes::namedfunction:0x0000000c7471e0>): 

there's way fix it?

i've never used part of arel, , can't test right now, i'm guessing instead of * need use arel::nodes::multiplication:

arel::nodes::multiplication.new(   arel::nodes::namedfunction.new(     'unix_timestamp', [arel::nodes::namedfunction.new('curtime', [4])]   ),   1000 ) 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -