On Mon, Apr 16, 2012 at 2:00 AM, Xavier Lange <[email protected]> wrote: > I just spent a few moments tracking down some unexpected behavior in > Sequel. I was trying to insert a value as such > > DB[:answers] << {:mode => :gut} > > And sequel raise an error complaining that there was no such column > 'gut'. Is this normal behavior? I would rather expect sequel to > convert the symbol automatically (perhaps that's 'magic') so instead > it should raise a 'unacceptable value' or perhaps some other option. > Ideas? >
Hi Xavier, Sequel always treats Symbols as column names. Otherwise it wouldn't be able to differentiate whether DB[:answers].where :foo => :bar was intended to mean: SELECT * FROM answers WHERE foo = bar (which is totally legal on a table with foo and bar columns) or: SELECT * FROM answers WHERE foo = 'bar' If there were a couple of special cases where Sequel might infer you "really" meant to use a value, I think it'd be a lot more confusing overall. Best, Peter -- Peter van Hardenberg San Francisco, California "Everything was beautiful, and nothing hurt." -- Kurt Vonnegut -- 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.
