Devise after_sign_in_path_for ... sending to .... root_path - query - ruby-on-rails

I need help with a routes issue with devise authentication gem to redirect to a custom page after successful login so as to create a new record by entering a test person name and age ( test data )
I am using Rails 3 with devise version 1.4.9
My routes are as below
new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_user_session DELETE /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
user_password POST /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
edit_user_password GET /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
PUT /users/password(.:format) {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET /users/cancel(.:format) {:action=>"cancel", :controller=>"devise/registrations"}
user_registration POST /users(.:format) {:action=>"create", :controller=>"devise/registrations"}
new_user_registration GET /users/sign_up(.:format) {:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET /users/edit(.:format) {:action=>"edit", :controller=>"devise/registrations"}
PUT /users(.:format) {:action=>"update", :controller=>"devise/registrations"}
DELETE /users(.:format) {:action=>"destroy", :controller=>"devise/registrations"}
testers GET /testers(.:format) {:action=>"index", :controller=>"testers"}
POST /testers(.:format) {:action=>"create", :controller=>"testers"}
new_tester GET /testers/new(.:format) {:action=>"new", :controller=>"testers"}
edit_tester GET /testers/:id/edit(.:format) {:action=>"edit", :controller=>"testers"}
tester GET /testers/:id(.:format) {:action=>"show", :controller=>"testers"}
PUT /testers/:id(.:format) {:action=>"update", :controller=>"testers"}
DELETE /testers/:id(.:format) {:action=>"destroy", :controller=>"testers"}
root / {:controller=>"testers", :action=>"index"}
In applications controller i tried to override the method like below but to no avail i still get routed back to tester index
class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_in_path_for(resource)
new_tester_path
end
end
In my routes.rb file i have the below lines
Testing::Application.routes.draw do
devise_for :users
resources :testers
root :to => 'testers#index'
While much of the code was done with scaffolding I was still not be able to figure how to redirect to new_tester_path or route /testers/new after successful sign_in by user email and password.
Can someone please let me know what i am missing..... while writing the override function, I would like to know the exact route i need to specify.
While testing i tried something stupid like this but the google page is also not opening ... :(
class ApplicationController < ActionController::Base
protect_from_forgery
helper ApplicationHelper
def after_sign_in_path_for(resource)
"www.google.com"
end
def after_sign_up_path_for(resource)
"www.google.com"
end
def after_update_path_for(resource)
"www.google.com"
end

Just use this snippet:
class ApplicationController < ActionController::Base
def after_sign_in_path_for(user)
user_url(user)
end
end

Try setting user_return_to path in session:
session['user_return_to'] = new_tester_path
You can do it in a controller derived from Devise::SessionsController

The Devise documentation explains all the steps to redirect to a specific page on successful sign in. By combine the techniques, you can redirect a user to many places after successful sign in.
Here is the resume:
You can do this in a controller you inherit from Devise::SessionsController - first, in controllers/users/sessions_controller.rb:
module Users
class SessionsController < Devise::SessionsController
def new
if params[:redirect_to].present?
self.resource = resource_class.new(sign_in_params)
store_location_for(resource, params[:redirect_to])
end
super
end
end
end
In config/routes.rb, you would have also added:
devise_for :users, controllers: {sessions: 'users/sessions'}
And you must add a custom after_sign_in_path_for in your ApplicationController
class ApplicationController < ActionController::Base
protected
def after_sign_in_path_for(resource)
stored_location_for(resource) || root_path
end
end
This works in all Devise versions, as I know.

I believe this is an inheritance issue. after_sign_in_path_for is originally defined within Devise::SessionsController. You can override it by making your SessionsController inherit from Devise::SessionsController, and then re-defining it within that controller.

If you are having issues trying to override the after_sign_in_path_for or after_sign_out_path_for helper methods within the ApplicationController of a Rails engine, you may want to check out this answer.
It describes how you'll need to override the SessionsController in your engine instead of the ApplicationController.

You don't seem to be doing anything wrong. Maybe this is a Devise issue.
Can you please try to isolate this on a Rails app and open an issue on Devise ?

Related

Rails Devise : how to update user by id?

I would like to update a user by id.
I don't know if I need to create another function or the devise update use function.
This doesn't work, it updates my current user instead of the user of data id (I update my user by axios api call):
const data = {
user = {
first_name: 'firstNameChanged'
id: 10
}
};
axios.put('http://localhost:3000/users', data).then((res) => {
console.log('user updated');
});
EDIT:
route.rb
devise_for :users, defaults: { format: :json }, controllers: { registrations: "registrations" }
devise_scope :user do
delete 'users/:id', to: 'registrations#destroy_by_id', defaults: { format: :json } # custom delete_by_id
end
rake routes
new_user_session GET /users/sign_in(.:format) devise/sessions#new {:format=>:json}
user_session POST /users/sign_in(.:format) devise/sessions#create {:format=>:json}
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy {:format=>:json}
new_user_password GET /users/password/new(.:format) devise/passwords#new {:format=>:json}
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit {:format=>:json}
user_password PATCH /users/password(.:format) devise/passwords#update {:format=>:json}
PUT /users/password(.:format) devise/passwords#update {:format=>:json}
POST /users/password(.:format) devise/passwords#create {:format=>:json}
cancel_user_registration GET /users/cancel(.:format) registrations#cancel {:format=>:json}
new_user_registration GET /users/sign_up(.:format) registrations#new {:format=>:json}
edit_user_registration GET /users/edit(.:format) registrations#edit {:format=>:json}
user_registration PATCH /users(.:format) registrations#update {:format=>:json}
PUT /users(.:format) registrations#update {:format=>:json}
DELETE /users(.:format) registrations#destroy {:format=>:json}
POST /users(.:format) registrations#create {:format=>:json}
DELETE /users/:id(.:format) registrations#destroy_by_id {:format=>:json}
thanks !
Devise actually only has routes and controllers to modify your own account. If you want an interface to administrate other users you are best off just creating it yourself or finding an existing implementation.
While its certainly possible to shoehorn this functionality into Devise its just going to get messy and violates the SRP as your RegistrationsController is no longer just responsible for handling user registration but also administrating other users.
You can pretty much just work off the Rails scaffolds (rails g scaffold users --skip-migration --skip-model) as its not really that different from CRUD'ing any other resource. What you really need is just something like:
# routes.rb
resources :users, except: [:new, :create]
# This controller is for administrating other users
class UsersController < ApplicationController
# ensures that there is a logged in user
# you should also implement authorization that ensures that the user is allowed to administrate other users
before_action :authenticate_user!
# sets the user to be acted upon
before_action :set_user, only: [:show, :edit, :update, :destroy]
# PUT|PATCH /users/1
def update
if #user.update(user_params)
head :ok
else
head :unprocessable_entity
end
end
# ...
private
def set_user
#user = User.find(params[:id])
end
def user_params
params.require(:user).permit(:first_name)
end
end
const data = {
user = {
first_name: 'firstNameChanged'
}
};
axios.put('http://localhost:3000/users/10', data).then((res) => {
console.log('user updated');
});
Check your rake routes | grep user and you'll find there is an entry under PUT. The path would look like /users/:id, that's your first mistake. This would also map (typically) to a UsersController#update action.
You can then access the id that's passed via the params (use strong params too) and find your user with User.find_by(id: permitted_params[:id]). You can create a private method called permitted_params along the lines of
def permitted_pararms
params.permit(:id)
end

undefined method `user_url' for Devise SessionsController:create

I have user model for authorization with devise gem. I want to add after_sign_in_path method:
# application_controller.rb
protected
# redirecting to appropriate url based on role
def after_sign_in_path_for(resource)
if current_user.has_role?(:admin)
dashboard_path
elsif current_user.has_role?(:student)
root_path
end
end
Whenever I try to sign in I get this error:
undefined method `user_url' for #<Devise::SessionsController:0x007fb89b5b00a8> Did you mean? course_url
I don't know why it says 'did you mean? course_url. But I have course model. And here are my routes:
authenticate :user do
resources :feeds, only: [:index]
resources :courses, only: [:index, :show]
# etc...
end
Also here is the code it points me:
if options.empty?
recipient.send(method, *args)
else
recipient.send(method, *args, options)
end
and first line of log:
actionpack (4.2.4) lib/action_dispatch/routing/polymorphic_routes.rb:220:in `polymorphic_method'
Whenever I commend after_sign_in_path_for I am able to sign in. If I comment contents of after_sign_in_path_for but leave empty after_sign_in_path_for method, I also get this error.
EDIT: I tested that I am not also signed in, not just not redirected. I think error happens right in the call after_sign_in_path_for, not in the redirect_to or whatever. Probably it has to do something with resource.
EDIT2: here are my rake routes:
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) registrations#cancel
user_registration POST /users(.:format) registrations#create
new_user_registration GET /users/sign_up(.:format) registrations#new
edit_user_registration GET /users/edit(.:format) registrations#edit
PATCH /users(.:format) registrations#update
PUT /users(.:format) registrations#update
DELETE /users(.:format) registrations#destroy
user_confirmation POST /users/confirmation(.:format) devise/confirmations#create
new_user_confirmation GET /users/confirmation/new(.:format) devise/confirmations#new
GET /users/confirmation(.:format) devise/confirmations#show
admin_root GET / rails_admin/main#dashboard
student_root GET / feeds#index
feeds GET /feeds(.:format) feeds#index
courses GET /courses(.:format) courses#index
course GET /courses/:id(.:format) courses#show
schools GET /schools(.:format) schools#index
school GET /schools/:id(.:format) schools#show
universities GET /universities(.:format) universities#index
university GET /universities/:id(.:format) universities#show
rails_admin /admin RailsAdmin::Engine
POST /graphql(.:format) graphql#create
landing_confirmation GET /landing/confirmation(.:format) landing#confirmation
landing_access_denied GET /landing/access_denied(.:format) landing#access_denied
root GET / landing#index
EDIT3: here is my github repo:
https://github.com/yerassyl/nurate
I had the same issue (Rails 7). I fixed it this way:
Add :turbo_stream as a navigational format. This line goes in config/initializers/devise.rb.
config.navigational_formats = ['*/*', :html, :turbo_stream]
Devise issue github
This error is thrown when the after_sign_in_path_for method is redefined in your app and returns nil value. As per my best guest, the provided snippet
def after_sign_in_path_for(resource)
if current_user.has_role?(:admin)
dashboard_path
elsif current_user.has_role?(:student)
root_path
end
end
is giving an error because none of the conditions are getting satisfied and hence the returned value is nil. To avoid such a case, you can always add an else condition which would get satisfied if no other does. Hence the below snippet should have worked (and will work for other users)
def after_sign_in_path_for(resource)
if current_user.has_role?(:admin)
dashboard_path
elsif current_user.has_role?(:student)
root_path
else
some_other_path || root_path
end
end
Hope this helps someone. Cheers :)
In config/devise.rb include this line:
config.navigational_formats = ['/', :html, :turbo_stream]
before rails s
This has done the trick for me.
def after_sign_in_path_for(resource)
if current_user.has_role?(:admin)
dashboard_path
elsif current_user.has_role?(:student)
root_path
else
root_path
end
end
Try to add a else condition in your code. This worked for me. I missed something like this.
If you have the same error with Devise::RegistrationsController, the answers of Jishnu and antoniolulee also works fine.
You have to uncomment in config/initializers/devise.rb line says
config.navigational_formats = ['*/*', :html]
and add :turbo_stream like this
config.navigational_formats = ['*/*', :html, :turbo_stream]
Make sure you've got a method on your AplicationController like follows
def after_sign_in_path_for(resource)
resource.next_step
end
Next_step is an attribute stored in the record during its creation, you may decide to hard code here some other path.

How to have a 'model' index and then also a 'model' index for each user(models_path & user_models_path)

I have a Tool model and I want to be able to have both a regular tools index (tools_path) that lists all the tools in the database for all users & also an users tool index(users_tools_path) that lists all the tools for a particular user.
I am not sure what the rails way of implementing this is. I am using devise and my instinct was to do the following in my routes:
Rails.application.routes.draw do
devise_for :users
root 'tools#index'
resources :users do
resources :tools
end
resources :tools
end
This gets me the following routes:
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
root GET / tools#index
user_tools GET /users/:user_id/tools(.:format) tools#index
POST /users/:user_id/tools(.:format) tools#create
new_user_tool GET /users/:user_id/tools/new(.:format) tools#new
edit_user_tool GET /users/:user_id/tools/:id/edit(.:format) tools#edit
user_tool GET /users/:user_id/tools/:id(.:format) tools#show
PATCH /users/:user_id/tools/:id(.:format) tools#update
PUT /users/:user_id/tools/:id(.:format) tools#update
DELETE /users/:user_id/tools/:id(.:format) tools#destroy
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
tools GET /tools(.:format) tools#index
POST /tools(.:format) tools#create
new_tool GET /tools/new(.:format) tools#new
edit_tool GET /tools/:id/edit(.:format) tools#edit
tool GET /tools/:id(.:format) tools#show
PATCH /tools/:id(.:format) tools#update
PUT /tools/:id(.:format) tools#update
DELETE /tools/:id(.:format) tools#destroy
This is my tools controller:
class ToolsController < ApplicationController
before_action :set_tool, only:[:show, :edit, :update, :destroy]
before_action :authenticate_user!, only:[:new, :destroy, :edit], notice: 'you must be logged in to proceed'
def index
#tools = Tool.all
end
def show
end
def new
#user = current_user
#tool = #user.tools.build
end
def create
#tool = Tool.new(tool_params)
#tool.save
redirect_to #tool
end
def edit
end
def update
#tool.update(tool_params)
redirect_to #tool
end
def destroy
#tool.destroy
redirect_to tools_path
end
private
def set_tool
#tool = Tool.find(params[:id])
end
def tool_params
params.require(:tool).permit(:name, :description)
end
end
These are my models:
class Tool < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :tools
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
Unfortunately at this point when I navigate to users/id/tools all the tools in the database are listed instead of only the tools for that particular user. Also when I look at the active record instances of each tool in my database the user_id column is nil
However I am stuck here. Obviously the code will be different for each index so I can't use the same index action for both situations or the same index.html.erb view page either.
I am wondering wheat the next step would be?
Here are a few things I am thinking I could do:
1) create a new action in my tools controller something like user_index and include the user & tool logic to fetch the tools associated to a particular user. I would also have to create a new user_index.html.erb view with the view code. Then I would delete the nested resource and add a route like: match 'users/:id/tools' => 'tools#user_index', :via => get
2) I can delete the stand alone resources :tools route and the add a get :user_index, :on => :collection in my nested tool resource. Then add a user_index action to my controller like in solution #1. The only problem here is that then all my routes would have the user/:id prefix which I do not want.
What is the best solution in this case? Also, why are my active record tool instances not saving the id of the user that created them? Is there a way to get them to save the user id without nesting the resources?
What is the rails way for this?
To only show the tools of a particular user, instead of doing:
#tools = Tool.all
You can make an instance variable that is an array of Tools that are assigned to a particular user. For example:
#user = User.find(params[:id])
#tools = Tool.where(user_id: #user.id)
This will only collect the tools where the tools user_id matches the user ID of the user loaded into the show view.
Then when you do your loop, it will show the right tools for that user.
With the answer above you can use:
#tools = (#user.present?) ? #user.tools : Tool.all
To be able to set the user of each tool you have to edit your:``
params.require(:tool).permit(:name, :description)
To include user
params.require(:tool).permit(:name, :description, :user)

Redirecting after sign in with Devise

I know this question has been asked quite a few times, but somehow it's not working for me. I would like the user to be redirected to a specific page after log in (using Devise). I'm using Rails 3.2 and Ruby 4.
As it is the user get redirected to:
- After login they get redirected to the root, if the user got to the login page from one of the pages controlled by the controller of which the root path is part of. These pages do not require authorization.
- After login they get redirected to the requested page, if the user automatically got to the login page by clicking on a page that requires authorization.
To redirect the user after login to a specific page, I understand that you need to add to the controller some lines. To the controller that is controlling the pages that required authorization I added:
class AccountsController < ApplicationController
before_filter :authenticate_user!
def user1_home
end
def user2_home
end
def user3_home
end
protected
def after_sign_in_path_for(resource)
'accounts/user1_home'
end
end
However, this didn't change anything. I also tried it with def after_sign_in_path_for(resource) 'accounts#user1_home_path' end
Should I perhaps also change something in routes.rb?
My routes are:
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
user_confirmation POST /users/confirmation(.:format) devise/confirmations#create
new_user_confirmation GET /users/confirmation/new(.:format) devise/confirmations#new
GET /users/confirmation(.:format) devise/confirmations#show
toc GET /toc(.:format) pages#toc
stakeholder GET /stakeholder(.:format) pages#stakeholder
about GET /about(.:format) pages#about
doelgroep_onderneming GET /doelgroep_onderneming(.:format) pages#doelgroep_onderneming
doelgroep_ngo GET /doelgroep_ngo(.:format) pages#doelgroep_ngo
doelgroep_se GET /doelgroep_se(.:format) pages#doelgroep_se
partnership GET /partnership(.:format) pages#partnership
contact GET /contact(.:format) pages#contact
account_stakeholder GET /account/stakeholder(.:format) accounts#stakeholder_home
account_business GET /account/business(.:format) accounts#business_home
account_admin GET /account/admin(.:format) accounts#admin_home
root / pages#index
You definitely shouldn't be defining methods per user in the Accounts controller.
Devise has instructions on github for accomplishing this: https://github.com/plataformatec/devise/wiki/How-To:-redirect-to-a-specific-page-on-successful-sign-in
You need to move after_sign_in_path_for to the ApplicationController class and you shouldn't have 'accounts/user1_home'. To go to the right url for each use you should have something along the lines of user_path(#user) but I don't have enough of your code to know exactly what to use. You should run in a console window the rake routes command to see what you routes you have made available. Read more about routing at: http://guides.rubyonrails.org/routing.html
Yes. Set the following at any point (before or after login):
session["user_return_to"] = request.original_url # Will redirect the user to where they came from
If it's an authenticated page they tried to access before logging in you want to redirect to then you can simply do it this way in your ApplicationController:
def after_sign_in_path_for(resource)
if session[:user_return_to] == nil
your_actual_next_path
else
super
end
end

Custom Registrations Controller for Devise not Overriding Create Action

I have been fighting with this for days now. I have created my own Registrations Controller to allow for an amdin to create and delete users. I have left the :registerable module in my devise configuration, as I also want to users to be able to edit their profiles. I have tried taking that module out just to see if it would solve my issue. The problem that I have, is that when I create a new user as an admin, it still signs that user in, despite having my own create action. I have tried everything that I can think of to get beyond this and I am stuck.
My Registrations Controller:
class RegistrationsController < Devise::RegistrationsController
load_and_authorize_resource
def new
super
end
def create
resource.build
if resource.save
redirect_to users_path
else
clean_up_passwords(resource)
render_with_scope :new
end
end
end
Application Controller: => note, after_sign_up_path_for was overriden here as a test to see if that would work
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from CanCan::AccessDenied do |exception|
flash[:error] = exception.message
redirect_to projects_url
end
protected
def stored_location_for(resource)
nil
end
def after_sign_in_path_for(resource)
projects_url
end
def after_sign_up_path_for(resource)
users_path
end
end
Routes File:
DeviseTest::Application.routes.draw do
devise_for :users, :controller => { :registrations => "registrations"}
devise_scope :user do
get '/login' => 'devise/sessions#new'
get '/logout' => 'devise/sessions#destroy'
end
resources :users, :controller => "users"
resources :projects
root :to => 'home#index'
end
And my Users Controller for admin view
class UsersController < ApplicationController
load_and_authorize_resource
# GET /users
# GET /users.xml
def index
#users = User.excludes( :id => current_user.id )
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => #users }
end
end
# DELETE /users/1
# DELETE /users/1.xml
def destroy
#user = User.find(params[:id])
#user.destroy
respond_to do |format|
format.html { redirect_to(users_url) }
format.xml { head :ok }
end
end
end
Rake Routes Output:
new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_user_session DELETE /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
user_password POST /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
edit_user_password GET /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
PUT /users/password(.:format) {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET /users/cancel(.:format) {:action=>"cancel", :controller=>"devise/registrations"}
user_registration POST /users(.:format) {:action=>"create", :controller=>"devise/registrations"}
new_user_registration GET /users/sign_up(.:format) {:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET /users/edit(.:format) {:action=>"edit", :controller=>"devise/registrations"}
PUT /users(.:format) {:action=>"update", :controller=>"devise/registrations"}
DELETE /users(.:format) {:action=>"destroy", :controller=>"devise/registrations"}
login GET /login(.:format) {:controller=>"devise/sessions", :action=>"new"}
logout GET /logout(.:format) {:controller=>"devise/sessions", :action=>"destroy"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
new_user GET /users/new(.:format) {:action=>"new", :controller=>"users"}
edit_user GET /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
PUT /users/:id(.:format) {:action=>"update", :controller=>"users"}
DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
projects GET /projects(.:format) {:action=>"index", :controller=>"projects"}
POST /projects(.:format) {:action=>"create", :controller=>"projects"}
new_project GET /projects/new(.:format) {:action=>"new", :controller=>"projects"}
edit_project GET /projects/:id/edit(.:format) {:action=>"edit", :controller=>"projects"}
project GET /projects/:id(.:format) {:action=>"show", :controller=>"projects"}
PUT /projects/:id(.:format) {:action=>"update", :controller=>"projects"}
DELETE /projects/:id(.:format) {:action=>"destroy", :controller=>"projects"}
root /(.:format) {:controller=>"home", :action=>"index"}
Everything else works as expected, I just cannot get the created user to not be signed in. It's not a huge issue for creating one user, but if I need to create 3 or 4, it's a huge p.i.t.a to have to signout, signin, every single time.
Any help on this is greatly appreciated.
On the third line of your routes.rb file, I think you mean :controllers => …, not :controller => …. You're missing an 's'.

Resources