How to add a temporary field to my devise form to use later?
I want to give users the option of registering 开发者_运维问答as a specified kind of user. The user type field however is in a separate table (for security reasons) so when I create a new account I also create a new record in the other table for that account.
So as far as I can tell, I can either create a new field in my devise created user table and then after_create have my model check for that field and then add it to my associated user permissions table. But that seems redundant, so is there a way to add some sort of temporary variable to the form and use that to create the user type?
When you want to create/edit two or more objects in the same form then you should user nested forms. You will find all necessery information in this two railscasts: http://railscasts.com/episodes/196-nested-model-form-part-1 and http://railscasts.com/episodes/197-nested-model-form-part-2
精彩评论