On May 29, 10:24 am, Joel VanderWerf <[email protected]> wrote:
> Jeremy Evans wrote:
> > On May 28, 10:38 pm, Joel VanderWerf <[email protected]> wrote:
> >> (1) why does
>
> >> entries = items.where("id" => id)
>
> >> fail, when "id" is apparently an acceptable substitute for :id in #<< ?
>
> > Because "id" in the filter is an SQL string. If you want an SQL
> > identifier, you should use :id.
>
> So the contents of that hash key could potentially be some other SQL
> string besides a column name? Or is this just for column names with
> spaces, symbols, etc.?
In a filter, the fact that it is a hash key is not special. These two
filters have the same semantics:
filter(:a=>'a') # WHERE a = 'a'
filter('a'=>:a) # WHERE 'a' = a
Jeremy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---