Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user.update_attributes(name: "Example User" , email:"example@railstutorial.org" , password:"foobar" , password_confirmation:"foobar")
- NameError: undefined local variable or method `user' for main:Object
- class UsersController < ApplicationController
- def show
- @user = User.find_by(params[:id])
- end
- def new
- end
- end
- class User < ApplicationRecord
- before_save { email.downcase! }
- validates :name, presence: true, length: { maximum: 50 }
- VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
- validates :email, presence: true, length: { maximum: 255 },
- format: { with: VALID_EMAIL_REGEX },
- uniqueness: { case_sensitive: false }
- has_secure_password
- validates :password, presence: true, length: { minimum: 6 }
- end
Add Comment
Please, Sign In to add comment