Note that there are some explanatory texts on larger screens.

plurals
  1. PODevise 2.0.4, Rails 3.2.3 - After creating user account I am redirected to root and can't access other routes
    primarykey
    data
    text
    <p>I'm coming from Sinatra to Rails and still quite new to Rails. My problem is that after I create a User account I am just directed to the index.html page in the /public folder and can't seem to access any other routes, I can't sign_out the user and I can't add another user.</p> <p>I am using the devise gem to manage my user model and authentication. After installing the gem I followed the instructions on the devise github page.</p> <p>ie:</p> <pre><code>rails generate devise:install </code></pre> <p>I also added to the 'config/environments/development.rb' file</p> <pre><code>config.action_mailer.default_url_options = { :host =&gt; 'localhost:3000' } </code></pre> <p>and I added to the 'config/routes.rb' file</p> <pre><code>root :to =&gt; "home#index" </code></pre> <p>and I added to the 'app/views/layouts/application.html.erb' file</p> <pre><code>&lt;p class="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt; &lt;p class="alert"&gt;&lt;%= alert %&gt;&lt;/p&gt; </code></pre> <p>Then I ran</p> <pre><code>rails generate devise User </code></pre> <p>And finally</p> <pre><code>rake db:migrate </code></pre> <p>Here is my user model</p> <pre><code>class User &lt; ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me # attr_accessible :title, :body end </code></pre> <p>Then I navigated to "/users/sign_up" and I entered an email and password after which I was redirected to the index.html page in the public folder.</p> <p>The problem is I just seem to be stuck there. '/users/sign_out' yields</p> <pre><code>Routing Error No route matches [GET] "/users/sign_out" Try running rake routes for more information on available routes. </code></pre> <p>And running 'rake routes' yields</p> <pre><code>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 root / home#index </code></pre> <p>Seems like '/users/sign_up' should be a working route.</p> <p>I am wondering if the problem is that there is no email service setup and this account is trying to be validated trough email? If so, how do I disable that?</p> <p>Thanks! And let me know if you need more information or for me to clarify something.</p> <p>===============UPDATE===================</p> <p>The 'users/edit' route does work and I think possibly the problem lies in the fact that the route that is setup for 'users/sign_out' is a DELETE route. I forget the terminology about this, but I know that there is some sort of trickery in making a DELETE route out of a GET route. So is this where my problem lies? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload