Exception when using params in a Ambition block

0 views
Skip to first unread message

slainer68

unread,
Jun 18, 2008, 12:03:47 PM6/18/08
to ambition.rb
Hi,

when using params[:something] in a select block like :
User.select { |u| u.login =~ params[:login] + "%" }

I get this :

Missing process method for sexp: [:vcall, :params]

If I patch ruby2ruby.rb and add a method like this :

def process_vcall(exp)
exp.shift.to_s
end

It works, but is that a good solution ?

Nicolas.

Allan

unread,
Jul 15, 2008, 6:10:58 AM7/15/08
to ambition.rb
Hi,

I can't say if the patch is a good idea or not but I thought that the
recommended way to handle this would be to move params[:login] + '%'
into a variable and compare against that.

e.g. (untested)

login = params[:login] + '%'
User.select{ |u| u.login =~ login }

On a different note, I'm beginning to question the long term viability
of Ambition, the support for it seems to have dried up since the
author's other projects have taken up his attention. I am not in a
position to support it myself at the moment but do have a need for a
Ruby-ish language for generating SQL queries that can be syntax
checked before execution and there are not too many alternatives!

Allan

Reply all
Reply to author
Forward
0 new messages