Skip to content

Instantly share code, notes, and snippets.

{
"title": "One",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
@vasinov
vasinov / gist:8855052
Created February 7, 2014 00:03
generate_authentication_token
def generate_authentication_token
loop do
token = Devise.friendly_token
hashed_token = BCrypt::Password.create(token)
update_attribute(:token_id, Devise.friendly_token)
final_token = "#{token_id}-#{token}"
break { token: final_token, hashed_token: hashed_token } unless User.where(authentication_token: hashed_token).first
end