Skip to content

Instantly share code, notes, and snippets.

@sgharms
Created Apr 10, 2015
Embed
What would you like to do?
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