Override controller

68 views
Skip to first unread message

Felipe Costa

unread,
Nov 3, 2010, 5:19:05 PM11/3/10
to plataforma...@googlegroups.com
I overrided RegistrationsController well, and i tried override SessionsController but i'm getting some trobous. 

This my routes.rb:

devise_for :users, :controllers => { :registrations => "registrations", :sessions => "sessions" }

My sessions_controller.rb:

class SessionsController  < Devise::SessionsController
  prepend_view_path "app/views/devise"
  
  def new
    super
  end

  def create
    super
  end

  def destroy
    super
  end
end 

I'm getting this error:
Unknown action

The action 'sessions#new' could not be found for SessionsController



Regards
--
Felipe Costa
Undergraduating in Computer Science at UFRJ
Black belt on JavaBlackBelt 

José Valim

unread,
Nov 3, 2010, 8:35:08 PM11/3/10
to Devise

Christian Fazzini

unread,
Dec 2, 2010, 4:34:38 PM12/2/10
to Devise
Hi Felipe, Jose. Is this a confirmed bug? Is there a solution for
this? I am coming across a similar problem

Grace

unread,
Jan 13, 2011, 2:31:50 PM1/13/11
to Devise
Hi all,

Along the similar lines of this issue. I'm trying to understand how
to override the devise SessionsController and what I've done is that
I've copied the code in the current devise repository devise / app /
controllers / devise/sessions_controller.rb into my own
sessions_controller.rb
this is what the code looks like

class SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only =>
[ :new, :create ]
include Devise::Controllers::InternalHelpers

# POST /resource/sign_in
def create
resource = warden.authenticate!(:scope => resource_name, :recall
=> "#{controller_path}#new")
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location =>
redirect_location(resource_name, resource)
end
end


I've also got the routes setup as indicated in the README file on
github.

However, I'm getting a method not found error is_navigational_format?

undefined method `is_navigational_format?' for #<SessionsController:
0x00000100ec7588>

I know this might be a simple fix, but I'm not sure how to refer to
this helper method in devise in my own controller.

thanks,

Grace

On Dec 2 2010, 4:34 pm, Christian Fazzini
Reply all
Reply to author
Forward
0 new messages