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

Compatibility with Rails 5 - attribute_fields #10

Closed
haslinger opened this issue Jul 18, 2016 · 4 comments
Closed

Compatibility with Rails 5 - attribute_fields #10

haslinger opened this issue Jul 18, 2016 · 4 comments

Comments

@haslinger
Copy link
Contributor

I forked the demo and updated it to ransack_demo / Rails 5.

The application itself starts, but within the condition group after adding a condition, the attribute field dropdown is missing.

I tried to debug the issue, and found that within the attribute_fields helper the call to the search_fields method returns an empty string.
In the old version (Rails 3.x) the proper html string for the dropdown was returned.

Reason for my findings is that I have exactly the same issue updating my own application to Rails 5 (so it's not specific to the demo app).

@jonatack
Copy link
Contributor

Thanks @haslinger. Would you like to add a PR to update ransack_demo to Rails 5?

@haslinger
Copy link
Contributor Author

@jonatack Yes, will do so in a few mins.

To document the monkey patches I did to make it Rails 5 compatible:
They are all in the file
https://github.com/haslinger/ransack_demo/blob/rails5/config/initializers/ransack.rb

While the second one
self.attributes << attribute # if attribute.valid?
is basically a bad hack, I believe that the constants for ASC and DESC are truly missing in current Ransack.

@jonatack
Copy link
Contributor

Thanks. The missing ASC and DESC was fixed in this commit.

@jonatack
Copy link
Contributor

Closing in favor of the open issue in Ransack. Thanks again!

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