0
をsimple_form:私はこのモデルを持っているカスタムクラスを持つレコードを作成し、
class User < ActiveRecord::Base
# abstract
end
class Company < User
end
class Person < User
end
は、どのように私はタイプの選択でフォームを作成することができますか?
<%= simple_form_for(@user) do |f| %>
<%# I would like to have a selector of classes ["Company","Person"] %>
<%= f.input :type %>
<%= f.input :name %>
<% end %>
どのようなコードを書くべきですか?
@user = User.new(params[:user]) # Pb params[:user][:type] have no effect
あなたは、会社、人のすべてのエンティティをリストするdropboxのようなものを持っているはずですか? – uday
あなたは単一のテーブルの継承を使用していますか? –