I have this line in the voice controller:
before_filter :authenticate
Therefore, when I vote upon exiting the system, it should disable this filter.
My authentication method in my application controller is as follows:
def authenticate logged_in? ? true : access_denied end
So, it returns access_denied , which looks like this:
def access_denied redirect_to login_path, :notice => "You must log in to perform this action." and return false end
So I have to be redirected to my login page, right?
I have this in the routes.rb file:
match '/login' => "sessions#new", :as => "login"
and I have a new view with a login form, which I should be redirected to when I vote and I have not logged in. I also have this code in the create method of my voice controller:
if @vote.save respond_to do |format| format.html { redirect_to @video } format.js end else respond_to do |format| format.html end end
But when I vote, I am not redirected, and I get this error message in my logs:
Started GET "/login" for 127.0.0.1 at Thu Mar 24 21:18:08 -0700 2011 Processing by SessionsController#new as JS Completed in 17ms ActionView::MissingTemplate (Missing template sessions/new with {:locale=>[:en, :en], :formats=>[:js, "*/*"], :handlers=>[:rhtml, :rxml, :erb, :builder, :rjs]} in view paths "/rubyprograms/dreamstill/app/views"):
Why is this happening, and how can I make this redirect work?