Customizing signup form adding fields from Profile

Skip to first unread message

Matthew Simpson

Jul 17, 2013, 3:28:21 PM7/17/13
Hi fellow Social Streamers -

I'm currently trying to customize the signup form (views/devise/registrations/new.html.erb). What I want to do is add a couple of fields which belong to the Profile. Now this form is for User, User includes Subject, and Subject accepts_nested_attributes_for Profile. So I was thinking I could just use fields_for in the view and add my profile fields there and it would all Just Work. Something like this inside the form_for:
<%= f.fields_for :profile do |ff| %>
  <%= ff.label :country %>
  <%= ff.text_field :country %>
<% end %>

However, the nested fields are not rendered. I thought I might need to set up a blank new Profile so I tried adding the following code before the form_for:

<% ||= ||=

But that didn't make any difference. Does anybody have any idea what I'm doing wrong and how I can add profile fields to the signup form?

Antonio Tapiador del Dujo

Jul 22, 2013, 10:30:04 AM7/22/13
Hi Matthew, it will be probably a problem related to attr_accessible attributes in the user model:

However, in my experience, I find easier delegating the fields from the user/actor to the profile model that struggling with nested attributes, which is quite powerful but a bit complex.

You can find an example of this in the ViSH's code, in the other direction (delegate from profile to the user model):

El 17/07/13 21:28, Matthew Simpson escribió:
You received this message because you are subscribed to the Google Groups "Social Stream" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Matthew Simpson

Jul 23, 2013, 5:31:37 AM7/23/13
Thanks Antonio, in the end I actually re-architected so this wasn't needed. But I will be displaying Actor fields on the Profile form so the example you gave will be helpful.

Yasir Hashmi

Jun 5, 2014, 12:27:06 PM6/5/14
I have a same question but example is removed
Reply all
Reply to author
0 new messages