Reputation: 155
When wanting to make a new entry to a model in Active Admin, I click on the action button "Create new New Employer". I then get this error message:
Formtastic::UnknownInputError in Admin::Employers#new
Unable to find input class BinaryInput
@input_class_finder.find(as)
rescue Formtastic::InputClassFinder::NotFoundError
raise Formtastic::UnknownInputError, "Unable to find input #{$!.message}"
end
# @api private
Upvotes: 1
Views: 2436
Reputation: 54
I came into this problem and didn't like the StringInput
solution because it is a single line and can't handle line breaks. You can similarly fix this by
# ./app/inputs/binary_input.rb
class BinaryInput < Formtastic::Inputs::TextInput
end
As seen with in this image https://i.sstatic.net/RHRex.png
Upvotes: 0
Reputation: 2198
I had the same problem editing a User
resource which, when created by Devise, has
t.inet "current_sign_in_ip"
column type.
If you are fine to change the data type from inet
to string
simply generate a migration:
rails g migration ChangeDatabaseColumnTypeForIpAddressesInUsers
class ChangeDatabaseColumnTypeForIpAddressesInUsers < ActiveRecord::Migration[5.2]
def change
change_column :users, :current_sign_in_ip, :string
change_column :users, :last_sign_in_ip, :string
end
end
Upvotes: 2
Reputation: 12514
This worked for me: create a file below and it will solve the error.
# app/inputs/inet_input.rb
class InetInput < Formtastic::Inputs::StringInput
end
In this case replace
inet
withBinaryInput
The possible problem is, Formtastic
is unable to map the column type to HTML input types.
this solution is tested with formtastic (~> 3.1)
Upvotes: 2
Reputation: 11929
@Nikita, first of all please read the docs https://github.com/activeadmin/activeadmin/tree/68d50d4221976df9d42e5d670b0877770ca8eeef/docs this will answer on most of your questions.
ActiveAdmin by default renders all the columns of your database table to display the form and is not able to show this particular one because there is no option to handle binary column( check, there is a binary typed column in your employers table)
so there are 2 options
1) override you form declaration how it described here https://github.com/activeadmin/activeadmin/blob/68d50d4221976df9d42e5d670b0877770ca8eeef/docs/5-forms.md
and use as: :string
options for your column if you need to display it at all.
2) it is possible also to create custom input to do this add initializer with such source that may not be your case.
class BinaryInput < Formtastic::Inputs::StringInput
end
Upvotes: 2