Displaying 1 result from an estimated 1 matches for "build_featur".
Did you mean:
build_feature
2011 Mar 02
2
Nested forms validation problem
...models/user.rb
class User < ActiveRecord::Base
has_one :feature
accepts_nested_attributes_for :feature
end
/app/models/feature.rb
class Feature < ActiveRecord::Base
belongs_to :user
validates :profile, :hobbies, :presence => true
end
/app/views/users/_form.html.erb
<% @user.build_feature %>
<%= form_for @user, :url => { :controller => :users, :action => "create"
} do |user| %>
<%= user.text_field :email %>
<%= render :partial => ''features/form'',
:locals => { :form => user } %>
/app/views/features/_form.html.er...