Further to Kirti's answer, you'll need to actually have a profile
to redirect to:
Models
#app/models/profile.rb
Class Profile < ActiveRecord::Base
belongs_to :user
end
#app/models/user.rb
Class User < ActiveRecord::Base
has_one :profile
before_create :build_profile #creates profile at user registration
end
Schema
profiles
id | user_id | name | birthday | other | info | created_at | updated_at
Routes
#config/routes.rb
resources :profiles, only: [:edit]
Controller
#app/controllers/profiles_controller.rb
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
#app/views/profiles/edit.html.erb
<%= form_for @profile do |f| %>
<% @attributes.each do |attr| %>
<%= f.text_field attr.to_sym %>
<% end %>
<% end %>
You'll then need to employ the after_sign_in_path
stuff Kirti posted
Updated
Here is the migration you'd use:
# db/migrate/[[timestamp]]_create_profiles.rb
class CreateProfiles < ActiveRecord::Migration[5.0]
def change
create_table :profiles do |t|
t.references :user
# columns here
t.timestamps
end
end
end