Closed scarfacedeb closed 10 years ago
@scarfacedeb Thanks for doing the isolation legwork.
The simplest hack for now is forking Formtastic with default_input_type made public. The only claim on this is that it stops the crashing. No warranties, no refunds. :)
gem 'formtastic', github: 'steakknife/formtastic'
Active admin form builder is using inherited method input which calls protected method default_input_type but since ActiveAdmin::FormBuilder is not the same class as Formtastic::FormBuilder it doesn't work. You can change the visibility of default_input_type by adding the following code to an initialiser
class ::Formtastic::FormBuilder public :default_input_type end
and the error will disappear.
Given the advice above and a passing build for Ruby 2.1.0 and Ruby 2.0.0 on Travis I'm marking this as closed.
I'm getting NoMethodError in Admin/companies#new in ruby 2.1.0p0. (RVM) In particular:
protected method 'default_input_type' called for #<ActiveAdmin::FormBuilder:0x00000008f20488>
Backtrace
This error is coming from
f.inputs/f.input
methods inside my model configurations. The most interesting part of the Full trace:Surprisingly, it works fine with ruby 2.0.0p353. I have no idea why.
Gem versions: aa_associations (0.1.2) from RubyGems activeadmin (0.6.2) formtastic (2.2.1)
OS: Debian Linux 3.10-3-amd64
Related issue in activeadmin repo: https://github.com/gregbell/active_admin/issues/2863#issuecomment-32196887
Possible cause
I'm not sure, but I think that the whole problem lies in Formtastic::TokenInputDefaultForAssociation module (_/lib/formtastic/token_input_default_forassociation.rb) that aliases
default_input_type
. And that module is dynamically included in Formtastic::Helpers::Input (_lib/active_adminassociations/engine.rb:19).As a result, formtastic tries to call that aliased
default_input_type_with_token_default_for_association
method, which is placed inside another module. and it causes ruby to throw an exception.Also, I managed to recreate that error using that code: