Hello.
I’m trying to do like this:
user.rb
class User < ActiveRecord::Base
has_one :user_profile
accepts_nested_attributes_for :user_profile
end
user_profile.rb
class UserProfile < ActiveRecord::Base
belongs_to :user
end
#app/views/users/_form.html.erb
<%= form_for @user do |user_form| %>
<%= user_form.fields_for :user_profile do | user_profile_form | %>
<%= user_profile_form.text_field :favorite_food %>
<% end %>
<% end %>
but it doesn’t render user_profile_form at all.
but it does render if user_profile is profile or user_profile ( no
underscore) .
Is this the way of Rails or a bug??
Can anyone teach me the right way to do it?
Thanks