On Dec 26, 12:47 pm, Jeremy Evans <[email protected]> wrote:
> On Dec 26, 9:32 am, Jason Dixon <[email protected]> wrote:
>
> > I'm trying to replace my original queries with bound variables but I'm
> > doing something wrong. Here's a sample query (with the original
> > commented out) that ends up returning nothing.
>
> > #@user = User.filter(:username => session[:user], :site_id => 1).first
> > ds = User.filter(:username => $u, :site_id => $s)
> > @user = ds.call(:first, :u => session[:user], :s => 1)
>
> > Any suggestions?
>
> You are using global variables, not symbols. You want:
>
> ds = User.filter(:username => :$u, :site_id => :$s)
Is it possible to use bound variables during initialize?
@user = User.new(:username => :$u, :site_id => 1).call(:u =>
params[:username])
NoMethodError - undefined method `call' for #<User
@values={:username=>"$u", :site_id=>1}>:
/Users/jdixon/Projects/foobar/web.rb:129:in `block in <class:Web>'
Thanks,
Jason
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.