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

ransack does not work out of the box #2

Open
yshmarov opened this issue Dec 15, 2024 · 0 comments
Open

ransack does not work out of the box #2

yshmarov opened this issue Dec 15, 2024 · 0 comments

Comments

@yshmarov
Copy link

Would need to add ransackable attributes to pay models for search to work. For example:

config/initializers/pay.rb

module RansackableAttributes
  extend ActiveSupport::Concern

  included do
    def self.ransackable_attributes(auth_object = nil)
      %w[id processor_id]
    end
  end
end

Rails.configuration.to_prepare do
  Pay::Subscription.include SubscriptionExtensions
  Pay::Subscription.include RansackableAttributes
  Pay::Charge.include RansackableAttributes
  Pay::Customer.include RansackableAttributes
end

Same goes for regular models, but it's less tricky for them

💡 Would make sense to have a separate avo resources generator for gem Pay

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

1 participant