Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User < ApplicationRecord
- # Include default devise modules. Others available are:
- # :confirmable, :lockable, :timeoutable and :omniauthable
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- has_one :profile, dependent: :destroy
- after_create :build_profile
- end
- class RegistrationsController < Devise::RegistrationsController
- protected
- def after_sign_up_path_for(resource)
- edit_profile_path(current_user)
- end
- end
- class Profile < ApplicationRecord
- belongs_to :user
- ...
- validates :name, presence: true
- end
- def set_profile
- @profile = Profile.friendly.find(params[:id])
- end
- Couldn't find Profile with 'id'=6
- def set_profile
- @profile = Profile.friendly.find(params[:id])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement