In my Rails 3.2 web application, I have User
, Resume
models. For resume, we have set columns like Name
, Email
, Date of Birth
, Nationality
, Educational Qualification
, Experience
etc. My requirement is that after a user is created by ADMIN, the Admin should be able to see a resume template
(HTML) where in basic details like Name
, Email
, Date of Birth
etc. would be taken from USER table to display it to the ADMIN for the first time. Then using best_in_place gem, the ADMIN should be able to edit and update all the values except Name and Email (non editable fields) to the RESUME table.
How I should go ahead?
class Resume < ActiveRecord::Base
belongs_to :user
attr_accessible :certification_info, :dob, :educational_info, :gender, :linguistic_ability, :marital_status, :nationality, :work_experience_info
end
class User < ActiveRecord::Base
has_one :resume
attr_accessible :login, :email, :name, :dob, :gender, :resume_attributes
accepts_nested_attributes_for :resume
end
How we could associate Resume
with User
models in routes in this case?
resources :users
Do we need to have a resume_controller
here?
How the view could be? Should I set up a form_for for User and then field_for for Resume? But I cannot use best_in_place
in that case, right?
Suggest a proper solution please .