Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. class User < ApplicationRecord
  2. # Include default devise modules. Others available are:
  3. # :confirmable, :lockable, :timeoutable and :omniauthable
  4. devise :database_authenticatable, :registerable,
  5. :recoverable, :rememberable, :trackable, :validatable
  6.  
  7. has_one :profile, dependent: :destroy
  8. after_create :build_profile
  9. end
  10.  
  11. class RegistrationsController < Devise::RegistrationsController
  12. protected
  13.  
  14. def after_sign_up_path_for(resource)
  15. edit_profile_path(current_user)
  16. end
  17.  
  18. end
  19.  
  20. class Profile < ApplicationRecord
  21. belongs_to :user
  22. ...
  23. validates :name, presence: true
  24. end
  25.  
  26. def set_profile
  27. @profile = Profile.friendly.find(params[:id])
  28. end
  29.  
  30. Couldn't find Profile with 'id'=6
  31.  
  32. def set_profile
  33. @profile = Profile.friendly.find(params[:id])
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement