I have two models: User and MemberProfile
class MemberProfile < ActiveRecord::Base belongs_to :user validates_presence_of :name #... end
class User < ActiveRecord::Base has_one :member_profile validates_presence_of :email accepts_nested_attributes_for :member_profile #... end
My view looks like:
<%= error_messages_for :user %> <% form_for :user, :url => users_path do |f| %> <p><%= f.label :email %> <%= f.text_field :email %></p> <% f.fields_for :member_profile do |mp| %> <p><%= mp.label :name %> <%= mp.text_field :name %> </p>
<% end %> <% end %>
The error validations are working correctly. It is checking for both email and name on both objects. The error list is correctly populating the error_messages_for call. The two problems I'm having are: 1. I'd like the errors for the MemberProfile object to be displayed as "Name can't be..." instead of "Member profile name can't be..." in div#errorExplanation 2. The MemberProfile fields are not receiving the div.fieldWithErrors
Is there a way to deal with these two issues?
Thanks