Assuming that I’m not signed in.
In this case, it displays this flash notice when accessing to actions in mails_controller.
You need to sign in or sign up before continuing.
However, it won’t display in communities_controller.
Why? and How can I fix?
mails_controller.rb
class MailsController < ApplicationController
before_filter :authenticate_user!
....
end
communities_controller.rb
class CommunitiesController < ApplicationController
load_and_authorize_resource :find_by => :id
before_filter :authenticate_user!
end
try moving the
load_and_authorize_resourceline after thebefore_filter. Theload_and_authorize_resourceline will raise an exception when it can’t find the resource for member actions which may be happening before you even get to thebefore_filterline