What is the appropriate Rspec syntax - ruby-on-rails

I can't figure out why my test is failing. I think it has to do with the delete method I'm using. For whatever reason, I can't get the link right for the delete action. The code for the site works, but I can't seem to have Rspec to map onto what's happening with the site. Any ideas?
View:
<li>
<%= link_to hunt.name, hunt %>
<% if current_user && current_user.admin? %>
| <%= link_to "edit", edit_hunt_path(hunt) %>
| <%= link_to "delete", hunt, :method => :delete, :confirm => "You sure?",
:title => "Delete #{hunt.name}" %>
<% end %>
</li>
Rspec test:
require 'spec_helper'
describe HuntsController do
render_views
describe "GET 'index'" do
...
describe "for users who are admins" do
before(:each) do
admin = FactoryGirl.create(:user, :email => "admin#example.com", :admin => true)
test_sign_in(admin)
end
...
it "should show delete link" do
get 'index'
Hunt.paginate(:page => 1).each do |hunt|
response.should have_selector('a', :href => hunt_path(#hunt) , :content => 'delete')
end
end
end
end
Rspec output:
1) HuntsController GET 'index' for users who are admins should show delete link
Failure/Error: response.should have_selector('a', :href => hunt_path(#hunt) , :content => 'delete')
ActionController::RoutingError:
No route matches {:action=>"show", :controller=>"hunts"}
# ./spec/controllers/hunts_controller_spec.rb:64:in `block (5 levels) in <top (required)>'
# ./spec/controllers/hunts_controller_spec.rb:63:in `block (4 levels) in <top (required)>'
And here's the output of running "rake routes":
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"}
hunts GET /hunts(.:format) {:action=>"index", :controller=>"hunts"}
POST /hunts(.:format) {:action=>"create", :controller=>"hunts"}
new_hunt GET /hunts/new(.:format) {:action=>"new", :controller=>"hunts"}
edit_hunt GET /hunts/:id/edit(.:format) {:action=>"edit", :controller=>"hunts"}
hunt GET /hunts/:id(.:format) {:action=>"show", :controller=>"hunts"}
PUT /hunts/:id(.:format) {:action=>"update", :controller=>"hunts"}
DELETE /hunts/:id(.:format) {:action=>"destroy", :controller=>"hunts"}
sessions POST /sessions(.:format) {:action=>"create", :controller=>"sessions"}
new_session GET /sessions/new(.:format) {:action=>"new", :controller=>"sessions"}
session DELETE /sessions/:id(.:format) {:action=>"destroy", :controller=>"sessions"}
/hunts(.:format) {:controller=>"hunts", :action=>"index"}
signup /signup(.:format) {:controller=>"users", :action=>"new"}
signin /signin(.:format) {:controller=>"sessions", :action=>"new"}
signout /signout(.:format) {:controller=>"sessions", :action=>"destroy"}
contact /contact(.:format) {:controller=>"pages", :action=>"contact"}
about /about(.:format) {:controller=>"pages", :action=>"about"}
help /help(.:format) {:controller=>"pages", :action=>"help"}
root / {:controller=>"pages", :action=>"home"}
/:controller(/:action(/:id(.:format)))

Not exactly sure why this happens.
But the log states that the view attempts to render a link which points to hunts#show
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
has examples like the first link in the view:
<%= link_to hunt.name, hunt %>
I assume that the link_to fails to get hunt's id and escapes with an RoutingError. hunt could be nil?
Either way, Ben says replacing the previous line with:
<%= link_to hunt.name, hunt_path(hunt) %>
fixed this.

Related

Routing Error when running controller spec (rspec)

I feel like I have everything I need in my routes.rb, my controller, and my controller spec, but for some reason I'm still getting a routing error (ActionController::RoutingError). Here's my controller:
class HunchController < ActionController::Base
protect_from_forgery
def results
auth_token_key = params[:auth_token_key]
user_id = params[:user_id]
#user = User.create!
#user.auth_token = #user.get_auth_token(auth_token_key, user_id)
#recommended_books = #user.get_recommended_books(#user.auth_token)
end
end
Here's my controller spec:
require 'spec_helper'
describe HunchController do
describe "POST 'results'" do
before do
#params = {
:auth_token_key => "my auth token",
:user_id => "my user id"
}
end
it "succeeds" do
post :results, #params
response.should be_success
end
end
end
And here's my routes.rb:
MyApplicationName::Application.routes.draw do
root :to => 'hunch#index'
resources :users
post 'hunch/results' => "hunch#results"
match '/results' => 'hunch#results'
end
EDIT: Here's my rake routes output:
root / {:controller=>"pages", :action=>"index"}
hunch_results POST /hunch/results(.:format) {:controller=>"hunch", :action=>"results"}
results /results(.:format) {:controller=>"hunch", :action=>"results"}
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"}
EDIT #2: I'm getting this error with my users#show test too. Here's the actual error:
1) UsersController#show succeeds
Failure/Error: get :show
ActionController::RoutingError:
No route matches {:controller=>"users", :action=>"show"}
# ./spec/controllers/users_controller_spec.rb:13:in `block (3 levels) in <top (required)>'
Ok, I got the same problem when gem journey was updated to the latest version. And find that if you got a route like this:
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
which have a param (id in this case), you necessarily need to render a link in template or use a user_path/user_url variables in controller with param too, so in your templates try to find:
<%= link_to "linkname", user_path %>
and replace by
<%= link_to "linkname", user_path(#user) %>
or search in any controller for the user_path/user_url usage and replace them by user_path(#user)/user_url(#user) accordingly.

No route matches {:action=>"show", :controller=>"users"} Error

I have the following going on:
rspec test in users_controller_spec:
it "should redirect to the user show page" do
post :create, :user => #attr
response.should redirect_to(user_path(assigns(:user)))
end
In my users_controller I have the following:
def show
#user = User.find(params[:id])
#title = #user.name
end
def create
#title = "Sign up"
#user = User.new(params[:user])
if #user.save
redirect_to #user, :notice => "Signed Up!"
else
#title = "Sign up"
render "new"
end
end
In my routes.rb I have the following:
Psra::Application.routes.draw do
resources :users
resources :sessions
# Root Route
root :to => 'pages#home'
# Pages Routes
match '/contact', :to => 'pages#contact'
match '/about', :to => 'pages#about'
match '/help', :to => 'pages#help'
match '/signup', :to => 'users#new'
# Users Route
match '/signup', :to => 'users#new'
#Sessions Routes
get "logout" => "sessions#destroy", :as => "logout"
get "login" => "sessions#new", :as => "login"
end
And Here is my rake routes
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"}
sessions GET /sessions(.:format) {:action=>"index", :controller=>"sessions"}
POST /sessions(.:format) {:action=>"create", :controller=>"sessions"}
new_session GET /sessions/new(.:format) {:action=>"new", :controller=>"sessions"}
edit_session GET /sessions/:id/edit(.:format) {:action=>"edit", :controller=>"sessions"}
session GET /sessions/:id(.:format) {:action=>"show", :controller=>"sessions"}
PUT /sessions/:id(.:format) {:action=>"update", :controller=>"sessions"}
DELETE /sessions/:id(.:format) {:action=>"destroy", :controller=>"sessions"}
root / {:controller=>"pages", :action=>"home"}
contact /contact(.:format) {:controller=>"pages", :action=>"contact"}
about /about(.:format) {:controller=>"pages", :action=>"about"}
help /help(.:format) {:controller=>"pages", :action=>"help"}
signup /signup(.:format) {:controller=>"users", :action=>"new"}
/signup(.:format) {:controller=>"users", :action=>"new"}
logout GET /logout(.:format) {:action=>"destroy", :controller=>"sessions"}
login GET /login(.:format) {:action=>"new", :controller=>"sessions"}
This all results in the following error:
1) UsersController POST 'create' success should redirect to the user show page
Failure/Error: response.should redirect_to(user_path(assigns(:user)))
ActionController::RoutingError:
No route matches {:action=>"show", :controller=>"users"}
# ./spec/controllers/users_controller_spec.rb:95:in `block (4 levels) in <top (required)>'
Any ideas on what I'm doing wrong?
It looks like to me that the show action isn't getting the user information it needs to get the correct page. The assigns method is just creating an instance variable. The user_path call will need a User mock or object to make the call work correctly.

I'm gettgin No route matches {:action=>"new", :controller=>"posts"} even though it's not in my routes.rb file. HELP?

OK so this is my first question posted to stackoverflow. I'm pretty new to coding, been learning Ruby on Rails for the past 3 months. There could be a few things wrong with my code but here it goes.
Basically I'm trying to get a User to Post. I'm using Devise for registration, and all of that works. But when I create a link to "Create Post" in my Header View, it tells me I don't have a route matching => even though I think it exists. I'm missing something small I believe but in all the debugging I've done to try and get it right, I think I might have messed something else up along the way. Below is attached my code for the routes.rb, my post_controller file, and my layout view file. Sorry about all the rambling, I couldn't be very concise. Does anyone see anything wrong? Let me know if you need to see other code
_header.html.erb
<% if user_signed_in? %>
Signed in as <%= current_user.username %>. Not you?
<%= link_to "Logout", destroy_user_session_path, :method => :delete, %>
<%= link_to "Create Post", new_user_post_path %>
<%= link_to "Search", posts_index_path %>
<%= link_to "Show All", posts_show_path %>
routes.rb
#devise_for :users
devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' end
match '/users/:user_id/posts/new', :to => 'posts#new'
resources :users do
resources :posts, :only => [:new, :create, :show, :index, :destroy]
end
match '/contact', :to => 'pages#contact'
match '/about', :to => 'pages#about'
match '/help', :to => 'pages#help'
match '/safety', :to => 'pages#safety'
match '/privacy', :to => 'pages#privacy'
get 'posts/index'
get 'posts/show'
get 'posts/post'
match 'posts/search', :to => 'posts#search'
root :to => 'pages#home'
posts_controller
def create
if signed_in?
#user = current_user.posts.build(params[:user][:post])
if #user.save
flash[:success] = "Thanks for creating your post! " +
redirect_to new_user_post_path(#post)
else
render 'new'
def new
#title = "Create Post"
#post = Post.new
end
rake routes
users_sign_out GET /users/sign_out(.:format) {:controller=>"devise/sessions", :action=>"destroy"}
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"}
/users/:user_id/posts/new(.:format) {:controller=>"posts", :action=>"new"}
user_posts GET /users/:user_id/posts(.:format) {:action=>"index", :controller=>"posts"}
POST /users/:user_id/posts(.:format) {:action=>"create", :controller=>"posts"}
new_user_post GET /users/:user_id/posts/new(.:format) {:action=>"new", :controller=>"posts"}
user_post GET /users/:user_id/posts/:id(.:format) {:action=>"show", :controller=>"posts"}
DELETE /users/:user_id/posts/:id(.:format) {:action=>"destroy", :controller=>"posts"}
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"}
contact /contact(.:format) {:controller=>"pages", :action=>"contact"}
about /about(.:format) {:controller=>"pages", :action=>"about"}
help /help(.:format) {:controller=>"pages", :action=>"help"}
safety /safety(.:format) {:controller=>"pages", :action=>"safety"}
privacy /privacy(.:format) {:controller=>"pages", :action=>"privacy"}
posts_index GET /posts/index(.:format) {:controller=>"posts", :action=>"index"}
posts_show GET /posts/show(.:format) {:controller=>"posts", :action=>"show"}
posts_post GET /posts/post(.:format) {:controller=>"posts", :action=>"post"}
posts_search /posts/search(.:format) {:controller=>"posts", :action=>"search"}
root /(.:format) {:controller=>"pages", :action=>"home"}
Try typing rake routes in the console and check if the route you are looking for exists. Note that the order also matters.
It should have been
<%= link_to "Create Post", new_user_post_path(current_user) %>
I think its because of the argument !
In your routes file it seems you are passing :user_id also.
In your link try passing that id.
Hope it helps...
<%= link_to "create Post", new_user_post_path(current_user.id) %>
Also I would suggest try renaming the path and use it.
I know its not proper way but still.
I had faced a similar problem and solved by doing this !!;)
Hope it helps !

Rails singular resource does't seem to generate 'user_path'

I have the following routes in my 3.1.0.rc5 app
# config/routes.rb
devise_for :users
resources :users, only: :index
resource :user
THe idea here is that I use devise for session management, the 'users' resource just to generate the users_path for the index action and then most other user actions would be accessible via routes like
GET user_path -> show action
GET new_user_path -> new action
POST user_path -> create action
The user_path route helper doesn't seem to be generated though, whenever I try to use it in a view, I get a weird error when rails tries to render it.
For example, on the /user/new page, I have the following
<%= form_for #user, :url => user_path do |f| %>
# omitted form elements
<% end %>
When rails tries to render the page I get
ActionView::Template::Error (No route matches {:action=>"destroy", :controller=>"users"}):
7: </div>
8:
9: <div class="content_middle">
10: <%= form_for #user, :url => user_path do |f| %>
11: <fieldset>
12: <%= render partial: "form_errors" %>
13:
app/views/users/new.html.erb:10:in `_app_views_users_new_html_erb___1548382046039026466_2191201580'
What's up with that!?
Edit Here is the content of rake routes. It's pretty massive so I cut it down to just the user related routes.
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"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
user DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
POST /user(.:format) {:action=>"create", :controller=>"users"}
new_user GET /user/new(.:format) {:action=>"new", :controller=>"users"}
edit_user GET /user/edit(.:format) {:action=>"edit", :controller=>"users"}
GET /user(.:format) {:action=>"show", :controller=>"users"}
PUT /user(.:format) {:action=>"update", :controller=>"users"}
It might make sense to have a Profile or CurrentUser controller in this situation. It would eliminate any routing conflicts you may be having with Devise, and also, it makes sense from a RESTful point of view as you're treating the current user as a distinct resource.
devise_for :user
resources :users, :only => :index
resource :profile

Rails & Devise: Two-step confirmation route error

I'm trying to make a two-step confirmation like heroku using Devise.
My routes:
devise_for :user, :controllers => {:confirmations => "confirmations", :registrations => "registrations" }
put "confirm_account", :to => "confirmations#confirm_account"
Here's my alternate confirmation controller:
class ConfirmationsController < Devise::ConfirmationsController
def show
#account = User.find_by_confirmation_token(params[:confirmation_token])
if !#account.present?
render_with_scope :new
end
end
def confirm_account
#account = User.find(params[:account][:confirmation_token])
if #account.update_attributes(params[:account]) and #account.password_match?
#account = User.confirm_by_token(#account.confirmation_token)
set_flash_message :notice, :confirmed
sign_in_and_redirect("user", #account)
else
render :action => "show"
end
end
end
Here's my show.html.erb:
<%= form_for(resource, :as => resource_name, :url => confirm_account_path(resource_name)) do |f| %>
<%= f.label :email %>
<%= #account.email %>
<%= f.hidden_field :confirmation_token %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %>
<%= f.submit 'Confirm Account' %>
<%= link_to 'Home', root_url %>
<%= render :partial => 'devise/shared/links' %>
<% end %>
When I click confirm after filling out the password (after clicking confirm in the confirmation email). I'm routed to /confirm_account.user That's pretty weird, right? What's going on to cause this problem?
Edit
rake routes returns:
new_user_session GET /user/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /user/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_user_session GET /user/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
user_password POST /user/password(.:format) {:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /user/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
edit_user_password GET /user/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
PUT /user/password(.:format) {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET /user/cancel(.:format) {:action=>"cancel", :controller=>"registrations"}
user_registration POST /user(.:format) {:action=>"create", :controller=>"registrations"}
new_user_registration GET /user/sign_up(.:format) {:action=>"new", :controller=>"registrations"}
edit_user_registration GET /user/edit(.:format) {:action=>"edit", :controller=>"registrations"}
PUT /user(.:format) {:action=>"update", :controller=>"registrations"}
DELETE /user(.:format) {:action=>"destroy", :controller=>"registrations"}
user_confirmation POST /user/confirmation(.:format) {:action=>"create", :controller=>"confirmations"}
new_user_confirmation GET /user/confirmation/new(.:format) {:action=>"new", :controller=>"confirmations"}
GET /user/confirmation(.:format) {:action=>"show", :controller=>"confirmations"}
user_unlock POST /user/unlock(.:format) {:action=>"create", :controller=>"devise/unlocks"}
new_user_unlock GET /user/unlock/new(.:format) {:action=>"new", :controller=>"devise/unlocks"}
GET /user/unlock(.:format) {:action=>"show", :controller=>"devise/unlocks"}
confirm_account PUT /confirm_account(.:format) {:action=>"confirm_account", :controller=>"confirmations"}
editreject_admin GET /admin/:id/editreject(.:format) {:action=>"editreject", :controller=>"admin"}
reject_admin GET /admin/:id/reject(.:format) {:action=>"reject", :controller=>"admin"}
accept_admin GET /admin/:id/accept(.:format) {:action=>"accept", :controller=>"admin"}
entries_admin_index GET /admin/entries(.:format) {:action=>"entries", :controller=>"admin"}
preferences_admin_index GET /admin/preferences(.:format) {:action=>"preferences", :controller=>"admin"}
admin_index GET /admin(.:format) {:action=>"index", :controller=>"admin"}
about_entries GET /entries/about(.:format) {:action=>"about", :controller=>"entries"}
all_entries GET /entries/all(.:format) {:action=>"all", :controller=>"entries"}
myentries_entries GET /entries/myentries(.:format) {:action=>"myentries", :controller=>"entries"}
rate_entry GET /entries/:id/rate(.:format) {:action=>"rate", :controller=>"entries"}
submit_entry PUT /entries/:id/submit(.:format) {:action=>"submit", :controller=>"entries"}
entry_comments POST /entries/:entry_id/comments(.:format) {:action=>"create", :controller=>"comments"}
entry_comment DELETE /entries/:entry_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
entries GET /entries(.:format) {:action=>"index", :controller=>"entries"}
POST /entries(.:format) {:action=>"create", :controller=>"entries"}
new_entry GET /entries/new(.:format) {:action=>"new", :controller=>"entries"}
edit_entry GET /entries/:id/edit(.:format) {:action=>"edit", :controller=>"entries"}
entry GET /entries/:id(.:format) {:action=>"show", :controller=>"entries"}
PUT /entries/:id(.:format) {:action=>"update", :controller=>"entries"}
DELETE /entries/:id(.:format) {:action=>"destroy", :controller=>"entries"}
/auth/:service/callback(.:format) {:controller=>"services", :action=>"create"}
services GET /services(.:format) {:action=>"index", :controller=>"services"}
POST /services(.:format) {:action=>"create", :controller=>"services"}
root /(.:format) {:controller=>"entries", :action=>"index"}
offline /offline(.:format) {:controller=>"application", :action=>"offline"}
Edit 3
In changing
devise_for :user, :controllers => {:confirmations => "confirmations", :registrations => "registrations" } do
match "/confirm_account", :to => "confirmations#confirm_account"
end
I'm receiving :
You have a nil object when you didn't
expect it! You might have expected an
instance of Array. The error occurred
while evaluating nil.[]
{"utf8"=>"✓",
"authenticity_token"=>"dsG/e8Tw2Oi6zEDb07R/L0yDOKFEFlse+IgLbfz3Lo0=",
"user"=>{"confirmation_token"=>"",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]"},
"commit"=>"Confirm Account"}
There's definitely a token in the url, though...This is actually going somewhere, though!
It looks to me like confirm_account_path doesn't exist?
If you didn't set up your routes manually, you can go ahead and set that in the config/routes.rb file, to confirmations#confirm_account.
Or, if you set Devise to use your ConfirmationsController, using new_user_confirmation_path may work too (and may not). Type rake routes in the console to see available routes. They should lead to the ConfirmationsController and the confirm_account action.
EDIT: Try editing your routes file as follows.
devise_for :user, :controllers => {:confirmations => "confirmations", :registrations => "registrations" } do
match "/confirm_account" => "confirmations#confirm_account"
end
I think the slash is important before confirm_account because it is now inside the devise_for block (which is identical to devise_scope). Otherwise it may go to users/confirm_account.
EDIT2: Use params[:user][:confirmation_token], not params[:account][:confirmation_token] in the controller. But currently it looks like the confirmation token is blank.

Resources