Here is my models:
class User < ActiveRecord::Base
has_one :worker, :class_name => 'Worker', :foreign_key => :worker_id
devise :database_authenticatable
accepts_nested_attributes_for :worker
attr_accessible :worker_id, :email, :password, :password_confirmation, :remember_me, :workers_attributes, :worker_attributes, :name, :worker
end
class Worker < User
devise :database_authenticatable, :registerable
belongs_to :user
attr_accessible :name, :worker, :workers
end
I am trying to add the field name to the registretion form at http://localhost:3000/workers/sign_up
The sign up form
<h2>Create Worker</h2>
<%= form_for resource, :as => resource_name, :url => registration_path(resource_name) do |f| %>
<%= devise_error_messages! %>
<table summary="Subject form fields">
<tr>
<th>Name:</th>
<td><%= f.text_field :name %></td>
</tr>
<tr>
<th><%= f.label :email %></th>
<td><%= f.text_field :email %></td>
</tr>
<tr>
<th><%= f.label :kodeord %></th>
<td><%= f.password_field :password %></td>
</tr>
<tr>
<th><%= f.label :bekraeft_kodeord %></th>
<td><%= f.password_field :password_confirmation %></td>
</tr>
</table>
<p><%= f.submit "Create Worker" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
But i get a template error: Model Worker does not respond to name And how do i create the association between User and Worker?
Best regards, Rails beginner