Whenever I use simple_form_for(), it has some really strange behaviour
for subclasses. For example, it defaults to “my_subclasses_path”
rather than “my_base_classes_path”. This can be corrected with a :url
=> some_path, but I am experiencing other frustrating problems.
In my case, I have a User object, but also many subclasses like Admin,
Director, etc. For some forms, I want to use a @user instance variable
and I want the resulting params hash to look like “params[:user]”
Unfortunately, if the @user instance is of the subclass “Admin”, it
will be sent as “params[:admin]” instead of params[:user]. This is not
what I want
I find this above problem to be REALLY odd because the HTML form
source code actually says “user[first_name]” and NOT
“admin[first_name]” - but simple_form seems to want to make it
params[:admin] anyway when it sends the post request.
I really wish there was an option in simple_form so we could say:
base_class => 'User'
That would handle all of these things.
How can fix my problem so that simple_form exposes the subclass as