In addition to Kirti's answer, you will need to have profileto redirect to:
Models
Class Profile < ActiveRecord::Base
belongs_to :user
end
Class User < ActiveRecord::Base
has_one :profile
before_create :build_profile
end
Scheme
profiles
id | user_id | name | birthday | other | info | created_at | updated_at
Routes
resources :profiles, only: [:edit]
controller
def edit
@profile = Profile.find_by user_id: current_user.id
@attributes = Profile.attribute_names - %w(id user_id created_at updated_at)
end
View
<%= form_for @profile do |f| %>
<% @attributes.each do |attr| %>
<%= f.text_field attr.to_sym %>
<% end %>
<% end %>
after_sign_in_path , Kirti
:
class CreateProfiles < ActiveRecord::Migration[5.0]
def change
create_table :profiles do |t|
t.references :user
t.timestamps
end
end
end