-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I've had a few questions about this issue and realize there's no description, so here it is!
Imagine a form like this:
# How it should work 😎
Superform @project do |form|
render form.field(:name).input
render form.field(:category).select(Category.select(:id, :name)))
endThe category field would submit back to Rails as category, which wouldn't work properly. Instead, what Rails expects, is category_id.
Currently Superform call model.send field on an object. Instead it should inflect on ActiveModel and ActiveRecord classes to see if a field is an association. If it is an association, it can get the foreign key and emit category_id as the name of the field.
# How it works today 😬
Superform @project do |form|
render form.field(:name).input
render form.field(:category_id).select(Category.select(:id, :name)))
endMetadata
Metadata
Assignees
Labels
No labels