我有这个模型:
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 %>
在controleur中,我应该写什么代码?
@user = User.new(params[:user]) # Pb params[:user][:type] have no effect