-
-
Save sgharms/d3a6f27ad7dee93eeef9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
def key_is_valid? | |
... | |
end | |
end | |
# A "helper" | |
def user_key_is_valid?(user, params) | |
user.user_key == params[:user_key] | |
end | |
# Imagine that we're here inside of a controller... | |
@user.user_key = params[:user_key] | |
@user.key_is_valid?(params[:user_key]) | |
user_key_is_valid?(User.find(params[:id]), params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment