Hey guys -
Prior to Sequel 3.20.0, I could do the following:
class FooBar < Sequel::Model(DB[Sequel::SQL::Identifier.new(:foo__bar)])
...
end
This would allow me to create a model backed by a table that has double
underscores in it. After 3.20.0, this causes the following error:
ArgumentError: wrong number of arguments (0 for 1)
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/dataset/misc.rb:123:in
`to_s'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/dataset/misc.rb:123:in
`hash'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/dataset/misc.rb:123:in
`sort_by'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/dataset/misc.rb:123:in
`each'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/dataset/misc.rb:123:in
`sort_by'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/dataset/misc.rb:123:in
`hash'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/model.rb:38:in
`[]'
/.rvm/gems/ruby-1.8.7-p334@sq3200/gems/sequel-3.20.0/lib/sequel/model.rb:38:in
`Model'
This is because the Sequel::Dataset instance has implemented a hash method
which calls #to_s on its options hash. Since the Sequel::SQL::Identifier
instance is in that options hash, it also has #to_s called on it. However,
all expressions (including this identifier instance) override #to_s so that
it requires a single argument being the Dataset.
Given that context, is there a more appropriate way to creating models that
are backed by tables with double underscores?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/vYwGmTcU_W0J.
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.