I dont know how to create a worker and a association. So i am able to link those together. I have a type colulm in user.
This is my form(http://localhost:3000/workers/sign_up):
<h2>Create Worker</h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<p><%= f.label :email %><br />
<%= f.text_field :email %></p>
<p><%= f.label :kodeord %><br />
<%= f.password_field :password %></p>
<p><%= f.label :bekraeft_kodeord %><br />
<%= f.password_field :password_confirmation %></p>
<p><%= f.submit "Create" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
This is my models:
Class Worker < User
devise :database_authenticatable, :registerable
end
Class Company < User
devise :database_authenticatable, :registerable
end
Class User < Appliaction::Base
devise :database_authenticatable, :registerable
end
I want to create a register form that create a User and a Worker. I have colums in Workers table as Name, Age and Adress that i want in the registration form.
Should it be a nested form and have should i create the association between worker and User table.
Best regards, Rails beginner