On Mon, Jun 21, 2021 at 4:32 PM John Knapp <[email protected]> wrote:

> Greetings and happy summer!
>
> I'd like to call a method within a query block thus:
>
>     def age_method
>       42
>     end
>
>     Artist.where{age > age_method}
>
> But I'm getting a PG::UndefinedColumn error
>
> What is the preferred approach?
>

This is covered in the virtual row guide:
http://sequel.jeremyevans.net/rdoc/files/doc/virtual_rows_rdoc.html .  You
pass an argument to the block and use the argument, instead of relying on
instance_exec:

  Artist.where{|o| o.age > age_method}

It's good to review Sequel's documentation, as it is reasonably
comprehensive: http://sequel.jeremyevans.net/documentation.html .  I
realize that doing so requires a significant time commitment.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSc4wK2WRGbnMu4Z5sfOy3MmUS0ieLzM57XChWpj9J5Q_Q%40mail.gmail.com.

Reply via email to