Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using list plugin results in Sequel::Error: No dataset associated with Sequel::Model #68

Closed
contentfree opened this issue Jul 11, 2014 · 2 comments

Comments

@contentfree
Copy link

Using the list plugin in a config.sequel.after_connect proc results in Sequel::Error: No dataset associated with Sequel::Model as the plugin itself calls model.dataset when prepending the order.

The problem is that SequelRails.setup (I believe) hasn't set the dataset on Sequel::Model (or its subclasses).

The workaround is to do plugin :list in the actual Sequel::Model subclass. (Which seems more proper anyway, but a note somewhere could save some headaches.)

@JonathanTron
Copy link
Member

Hello @contentfree, thanks for reporting this issue!

I think your problem is not related to when sequel-rails calls the after_connect hook, but about this specific plugin. It's not meant to be used globally, but only on a specific subclass of Sequel::Model which means the backing table already exist. Hence the error message Sequel::Error: No dataset associated with Sequel::Model which state that no dataset (and not database) is associated to Sequel::Model.

I can add a note about each plugin in Sequel being special and that user should be careful what plugin requirement is before trying to add them globally to all Sequel::Model subclasses. What do you think?

@contentfree
Copy link
Author

Makes sense. Calling those special ones out with docs would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants