-
Notifications
You must be signed in to change notification settings - Fork 365
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
Added the possibility to use scopes with arguments, by passing a array or a lambda via the scopes option and more. #121
base: master
Are you sure you want to change the base?
Conversation
…y or a lambda via the scopes option.
…e columns passed to select and the values are the names of the methods to be called or lambdas.
…to scopes lambdas.
Thanks for this pull request, it looks really interesting, just one thing, can you add some test coverage? I ran tests and some of them are broken |
sorry, made those changes in a rush, I'll have a look at the tests! |
…autocomplete_items methods.
… 'with extra data' test check that the extra data attribute is actually returned.
I've fixed the existing tests and added some new unit tests for the |
…on that generate an id field and set the id_element html option.
I've made another change that I think would be worthwhile. For the Formtastic custom input, you can now do:
and it will generate the id field then set the id_element option. I understand this pull request is starting to get big, that's because I'm lazy, so if you don't like that last feature I could move it to another branch. |
…tion and removed the minified version of the JS file.
…used for the content of the autocompletion list.
…d call it when creating autocomplete field.
please merge this. |
This can be really useful in certain situations, there's two ways of using scopes with arguments, by sending an array and with a lambda. Here's an example with the former:
And for lambdas:
The lambda way isn't really as nice as I'd like, maybe giving the lambda direct access to the controller environment would be better but I'm not sure how to do that.
Update
I've also added the possibility to use a custom action name and improved the way the extra_data option work by making accept hashes, here's a complete example:
Edit: Updated last code example to reflect changes in 1f09e1f.