Where do simplicity and code meet? This presentation is an attempt to show why certain tools can be considered simple, minimalistic, or otherwise part of the less code culture.
4 class User 5 devise :database_authenticatable 6 end 7 8 # In the controller 9 class ApplicationController < ActionController::Base 10 before_action :authenticate_user! 11 end
4 class User 5 devise :database_authenticatable 6 end 7 8 # In the controller 9 class ApplicationController < ActionController::Base 10 before_action :authenticate_user! 11 end
include Shield::Model 4 5 def self.fetch(username) 6 # Find user 7 end 8 end 9 10 # In the controller/routes 11 @user = User.authenticate("tonchis", "pass1234")
80 81 if user and is_valid_password?(user, password) 82 return user 83 end 84 end 78 def authenticate(username, password) 79 user = fetch(username) 80 81 if user and is_valid_password?(user, password) 82 return user 83 end 84 end