I have a table User
that inherits from a table called Person
我有一个表继承自一个名为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.input :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.
这会在ol中生成一个fieldset,这本身就是无效的,但这并不是让我担心的问题。我想摆脱字段集,所以所有属性都显示在同一级别。
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.
当然这是无效的,在输入中没有for:for。
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.
我在考虑使用委托,但后来我在Person模型中也有很多accepts_nested_attributes_for,它们会破坏。
Also the Person
table is being inherited by another model.
Person表也被另一个模型继承。
There is any gem that transparentize this and allow me to just inherit the model?
有没有透明化的宝石,让我继承模型?
1 个解决方案
#1
6
Use semantic_fields_for
instead of inputs
:
使用semantic_fields_for而不是输入:
f.inputs 'Something' do
f.semantic_fields_for :person do |p|
p.input :name
p.input :surname
end
f.input :account
end
#1
6
Use semantic_fields_for
instead of inputs
:
使用semantic_fields_for而不是输入:
f.inputs 'Something' do
f.semantic_fields_for :person do |p|
p.input :name
p.input :surname
end
f.input :account
end