Skip to content

Instantly share code, notes, and snippets.

@fellix
Created October 11, 2012 01:57
Show Gist options
  • Save fellix/3869699 to your computer and use it in GitHub Desktop.
Save fellix/3869699 to your computer and use it in GitHub Desktop.
Custom token authenticable
class SomeController < ApplicationController
before_filter :authenticate_with_public_token!
private
def authenticate_with_public_token!
if params[:key] && user = User.find_by_public_token(params[:key])
sign_in("user", user)
else
authenticate_user!
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment