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

fix 4.0.0v ransack #132

Merged
merged 3 commits into from
May 12, 2023
Merged

fix 4.0.0v ransack #132

merged 3 commits into from
May 12, 2023

Conversation

le-murier
Copy link
Contributor

It's looking a little bit ugly, but will allow all attributes and no association.
Pr for #131

@@ -60,6 +60,7 @@ def self.model_name
klass = ActiveRecord::Base.descendants.detect { |c| c.table_name == table_name }
end

ransack_methods(klass)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. please rename to add_ransack_methods
  2. add a dependency in gemspec file to include ransack >= 4, this way it will require all developers to upgrade (OR to not make it so strict just add a check in the code if Ransack::VERSION >= 4.0 and then call this method)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the if Ransack::VERSION >= 4.0, but got strange error NameError (uninitialized constant Ransack::VERSION).
Screenshot 2023-05-04 at 12 58 36
So, I can get version in way like this
ransack_gem = Gem.loaded_specs['ransack']
add_ransack_methods(klass) if ransack_gem.version >= Gem::Version.new('4.0.0'). But not sure if it will be okay 👾👾👾

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good solution, as long specs are passed this is good for me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igorkasyanchuk fixed ( ˘▽˘)っ♨

@igorkasyanchuk
Copy link
Owner

@le-murier I think code is good enough to solve this issue, please check the comments

@le-murier le-murier requested a review from igorkasyanchuk May 4, 2023 11:41
@igorkasyanchuk igorkasyanchuk merged commit 71c6b54 into igorkasyanchuk:master May 12, 2023
@igorkasyanchuk
Copy link
Owner

@le-murier new version was released. thanks!

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

Successfully merging this pull request may close these issues.

2 participants