Rails Generate Devise::session controller

352 views
Skip to first unread message

Maddy

unread,
Sep 3, 2012, 5:58:41 AM9/3/12
to rubyonra...@googlegroups.com
Hi Folks,

Am new to rails.

I user devise in my project ,i need to write some conditions in my session controller.How can i generate devise session controller.

Devise::SessionsController

Please advice..


Ashokkumar Yuvarajan

unread,
Sep 3, 2012, 6:01:35 AM9/3/12
to rubyonra...@googlegroups.com
Hi Folks,

Am new to rails.

I used devise in my project ,i need to write some conditions in my session controller.How can i generate devise session controller.

Devise::SessionsController

Please advice..



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/_M1lERzVv-oJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
"Attitude is a little thing that makes a big difference"

Thanks & Regards
Ashokkumar.Y
ROR-Developer
email : ashok...@shriramits.com




G S RAO

unread,
Sep 3, 2012, 6:10:56 AM9/3/12
to rubyonra...@googlegroups.com

1) Create your custom controller, for example a Admins::SessionsController:

class Users::SessionsController < Devise::SessionsController
end

2) Tell the router to use this controller:

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

3)  we changed the controller, it won't use the "devise/sessions" views, so remember to copy "devise/sessions" to "user/sessions".

Any queries follow the topic

Configuring controllers


in the page

 https://github.com/plataformatec/devise
-------------Regards---------------
G SubbaRao ( Ruby Developer )
E-Mail:subbar...@gmail.com
http://railsdocuments.blogspot.com



Ashokkumar Yuvarajan

unread,
Sep 4, 2012, 3:12:01 AM9/4/12
to rubyonra...@googlegroups.com
Hi,

I created session::controller as u said and also used routes like devise_for :users, :controllers => { :sessions => "users/sessions" }

But i got an error 

Routing Error

uninitialized constant Users

Try running rake routes for more information on available routes.

Please advice...

Jordon Bedwell

unread,
Sep 4, 2012, 3:49:41 AM9/4/12
to rubyonra...@googlegroups.com
On Tue, Sep 4, 2012 at 2:12 AM, Ashokkumar Yuvarajan
<ashok...@shriramits.com> wrote:
> Hi,
>
> I created session::controller as u said and also used routes like devise_for
> :users, :controllers => { :sessions => "users/sessions" }
>
> But i got an error
>
> Routing Error
>
> uninitialized constant Users

Because you don't have a User model.

Ashokkumar Yuvarajan

unread,
Sep 4, 2012, 5:15:16 AM9/4/12
to rubyonra...@googlegroups.com
I have user.rb model.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


subbarao

unread,
Sep 4, 2012, 7:28:36 AM9/4/12
to rubyonra...@googlegroups.com
Your error saying that you don't have Users model and controler may be you created the devise as Admin.
If so please replace user with admin in all places.

If u want to understand flow take new project and try documentation ( https://github.com/plataformatec/devise ) from top to bottom, then u will understand flow after that you can implement in your project .
Reply all
Reply to author
Forward
0 new messages