How do I create a formtastic nested input without fieldset?
I have a table User
that inherits from a table called Person
Long story short, instead of having to do the following:
f.inputs 'Something' do
f.inputs for: :person do |f|
f.input :name
f.input :surname
end
f.in开发者_运维百科put :account
end
This generates an fieldset
inside an ol
, which is by itself invalid, but that's not what worries me. I want to get rid of the fieldset
so all the attributes are shown at the same level.
f.inputs 'Something' do
f.input :name, for: :person
f.input :surname, for: :person
f.input :account
end
Of course that is not valid, there is not such thing as a for: in the input.
I was thinking about using delegate, but then I though that I also have a lot of accepts_nested_attributes_for
in the Person
model and them would broke.
Also the Person
table is being inherited by another model.
There is any gem that transparentize this and allow me to just inherit the model?
Use semantic_fields_for
instead of inputs
:
f.inputs 'Something' do
f.semantic_fields_for :person do |p|
p.input :name
p.input :surname
end
f.input :account
end
精彩评论