Guest User

Untitled

a guest
Aug 23rd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. user.update_attributes(name: "Example User" , email:"example@railstutorial.org" , password:"foobar" , password_confirmation:"foobar")
  2.  
  3. NameError: undefined local variable or method `user' for main:Object
  4.  
  5. class UsersController < ApplicationController
  6.  
  7. def show
  8. @user = User.find_by(params[:id])
  9. end
  10.  
  11. def new
  12. end
  13. end
  14.  
  15. class User < ApplicationRecord
  16. before_save { email.downcase! }
  17. validates :name, presence: true, length: { maximum: 50 }
  18. VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
  19. validates :email, presence: true, length: { maximum: 255 },
  20. format: { with: VALID_EMAIL_REGEX },
  21. uniqueness: { case_sensitive: false }
  22. has_secure_password
  23. validates :password, presence: true, length: { minimum: 6 }
  24. end
Add Comment
Please, Sign In to add comment