LoginSignup
1
2

More than 3 years have passed since last update.

「Formtastic::UnknownInputError Unable to find input class Input」の対処法

Posted at

最近の勉強で学んだ事を、ノート代わりにまとめていきます。
主に自分の学習の流れを振り返りで残す形なので色々、省いてます。
Webエンジニアの諸先輩方からアドバイスやご指摘を頂けたらありがたいです!

Formtastic::UnknownInputError Unable to find input class Input

このエラーが起きた状況は、Active Adminで作成したユーザー管理画面において編集機能を追加するために
actionsに:editを追加した所、発生しました。

app/admin/users.rb
actions :index , :show , :edit

こちらの解決方法は、Issueに書いてあり。
Formtastic::UnknownInputError Unable to find input class Input · Issue #4178 · activeadmin/activeadmin · GitHub

Yes sandy's hack works and should be done by rails g active_admin:install IMHO!
Basically the class needs to be there otherwise no edit's and no updates are possible...
Works fine on rails 5.0.6 and activeadmin 1.1.0...
I put this file in /admin dir, this works and it's a more logical place for me.

app/admin/inet_input.rb with following content:
#put this in app/admin/inet_input.rb so that edit/update of resources work with activeadmin
class InetInput < Formtastic::Inputs::StringInput
end

adminフォルダーにinet_input.rbファイルを作成し、中身をこの様に記述すると解決できました!

app/admin/inet_input.rb
class InetInput < Formtastic::Inputs::StringInput
end
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2