devise: how to allow unauthenticated access to some pages?

Viewed 741

I have implemented Rails with devise authentication. As part of the process I added a "global" before_action :authenticate_user! in the application_controller that requires that all pages must be authenticated.

# app/controllers/application_controllers.rb

class ApplicationController < ActionController::Base
  before_action :authenticate_user!
end

How do I allow some controller#actions to be accessed without requiring the user to log in first.

This is useful when sending out mass emailings, and the email contains the link to a #show action which usually requires authentication.

2 Answers
Related