Skip to content

Unsupported field types #39

Closed
Closed
@bbenezech

Description

Hello again,

Simple form doesn't support all field types.
For example jsonb columns will raise

ActionView::Template::Error (No input found for jsonb):
    14:           </div>
    15:
    16:         <% else %>
    17:           <%= form.input name, label: name %>
    18:         <% end %>
    19:       <% end %>
    20:     </div>
  simple_form (3.2.0) lib/simple_form/form_builder.rb:574:in `find_mapping'
  simple_form (3.2.0) lib/simple_form/form_builder.rb:503:in `find_input'
  simple_form (3.2.0) lib/simple_form/form_builder.rb:113:in `input'
  rails_db (1.0) app/views/rails_db/tables/_edit.html.erb:17:in `block (2 levels) in ___sers_ben__rvm_gems_ruby_______gems_rails_db_____app_views_rails_db_tables__edit_html_erb___3087035280528385302_70164055306820'

The way you handle it is your call. I guess I would default to text.
Not sure how.

Catching around form.input name, label: name and retrying with as: :text looks dirty, maybe you can try to toy around SimpleForm API to see if they expose smtg than can help you in find_mapping.

Unless you want to go with user-faced config hooks, but I sure wouldn't!

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions