Skip to content

Instantly share code, notes, and snippets.

@Chryus
Last active August 29, 2015 13:57
Show Gist options
  • Save Chryus/9592000 to your computer and use it in GitHub Desktop.
Save Chryus/9592000 to your computer and use it in GitHub Desktop.
Example of a before_filter that triggers a Devise method that redirects to login for all actions with exceptions. Rails 4/Devise authentication solution.
class EventsController < ApplicationController
before_filter :authenticate_user!, :except => [:show, :index, :api_by_name]
def index
@events = Event.all
end
###
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment