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

Hash parameters do not work outside of Rails #510

Closed
HashNotAdam opened this issue Jul 2, 2021 · 1 comment
Closed

Hash parameters do not work outside of Rails #510

HashNotAdam opened this issue Jul 2, 2021 · 1 comment
Labels

Comments

@HashNotAdam
Copy link

When using vanilla Ruby, including hash parameters does not work because the with_indifferent_access method has not been patched onto hashes and is required by lib/active_interaction/filters/hash_filter.rb. This is solved by:

require "active_support/core_ext/hash/indifferent_access"

Simple example:

require "active_interaction"

module ActiveInteractionTest
  class Interaction < ActiveInteraction::Base
    hash :parameters

    def execute
      puts "All is fine"
    end
  end
end
ActiveInteractionTest::Interaction.run(parameters: {})
/Users/arice/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/active_interaction-4.0.3/lib/active_interaction/filters/hash_filter.rb:47:in `adjust_output': undefined method `with_indifferent_access' for {}:Hash (NoMethodError)
@AaronLasseigne
Copy link
Owner

I actually happened across this the other day (2d8ee0a). It'll be in the next release. Thanks for reporting it though!

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

No branches or pull requests

2 participants