On Thursday, October 27, 2016 at 8:59:13 AM UTC-7, Chris Hanks wrote: > > I'm using column_select on all models in an application, and the server is > booted but a table doesn't exist (usually because a dev forgot to migrate > after switching branches), the following error pops up: > > /home/chris/.rvm/gems/ruby-2.3.0/bundler/gems/sequel-cc1e5c342b95/lib/sequel/plugins/column_select.rb:52:in > > `convert_input_dataset': undefined method `map' for nil:NilClass > (NoMethodError) > Did you mean? tap > from > /home/chris/.rvm/gems/ruby-2.3.0/bundler/gems/sequel-cc1e5c342b95/lib/sequel/model/base.rb:798:in > > `set_dataset' > from > /home/chris/.rvm/gems/ruby-2.3.0/bundler/gems/sequel-cc1e5c342b95/lib/sequel/model/plugins.rb:45:in > > `block in after_set_dataset' > from > /home/chris/.rvm/gems/ruby-2.3.0/bundler/gems/sequel-cc1e5c342b95/lib/sequel/model/base.rb:629:in > > `inherited' > > This is a pretty common occurrence in our shop. I'm not sure what the > ideal behavior is - maybe to raise a nicer error, maybe another conditional > to just try not to apply the select in that case? >
We should probably just wrap that code in "if cols", as we do a couple lines above, I'll make that change before the next release. Note that Sequel.require_valid_table will default to true in Sequel 5, so anytime you try to use a model when the table does not exist, an error will be raised. I think it's better to raise an error early in this case, instead of failing later. 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
