You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
The issue I came across has to do with the way rails4 casts parameters to ActionController::Parameters objects. There are some methods rails expects to exist on these objects, but the are missing if the tpkg gem is loaded
Easiest way to repro this would be to run a rails4 app that has tpkg in the Gemfile default group, then execute these steps from the rails console
$raw_parameters = { :teams => { :number => "37" } }
$parameters = ActionController::Parameters.new(raw_parameters)
$parameters.require(:teams).permit!
NoMethodError: undefined method `permitted=' for {"number"=>"37"}:ActiveSupport::HashWithIndifferentAccess
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/actionpack-4.1.4/lib/action_controller/metal/strong_parameters.rb:325:in `block in dup'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/actionpack-4.1.4/lib/action_controller/metal/strong_parameters.rb:324:in `tap'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/actionpack-4.1.4/lib/action_controller/metal/strong_parameters.rb:324:in `dup'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/activesupport-4.1.4/lib/active_support/hash_with_indifferent_access.rb:50:in `with_indifferent_access'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/tpkg-2.3.3/lib/tpkg/metadata.rb:135:in `convert_value'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/tpkg-2.3.3/lib/tpkg/metadata.rb:51:in `[]='
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/actionpack-4.1.4/lib/action_controller/metal/strong_parameters.rb:337:in `convert_hashes_to_parameters'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/actionpack-4.1.4/lib/action_controller/metal/strong_parameters.rb:282:in `[]'
from /Users/jmcallister/.rvm/gems/ruby-2.1.2@ypleads-sales-tool/gems/tpkg-2.3.3/lib/tpkg/metadata.rb:36:in `default'
The output should be
=> {"number"=>"37"}
Now the tpkg gem should not get loaded with rails. It is / was getting loaded b/c it is / was part of the default group in bundler in our application. We no longer include tpkg in the default bundler group, which resolves the issue.
But it still seems risky to define HashWithIndifferentAccess class in tpkg in the event that it's already defined by someone else.
Perhaps there is a way to conditionally create HashWithIndifferentAccess if it's not already defined by someone else (like ActiveSupport)?
The issue I came across has to do with the way rails4 casts parameters to ActionController::Parameters objects. There are some methods rails expects to exist on these objects, but the are missing if the tpkg gem is loaded
Easiest way to repro this would be to run a rails4 app that has tpkg in the Gemfile default group, then execute these steps from the rails console
The output should be
Now the tpkg gem should not get loaded with rails. It is / was getting loaded b/c it is / was part of the default group in bundler in our application. We no longer include tpkg in the default bundler group, which resolves the issue.
But it still seems risky to define HashWithIndifferentAccess class in tpkg in the event that it's already defined by someone else.
Perhaps there is a way to conditionally create HashWithIndifferentAccess if it's not already defined by someone else (like ActiveSupport)?
some references
https://github.com/rails/strong_parameters
rails/strong_parameters#140