(Rails 3.1, Heroku cedar, ruby 1.9.3, macosx, eclipse, git)
My application is deployed on heroku cedar, and the devise sign-in layer worked fine in the last version but the users-path now throws a missing template error. It works fine on my development machine.
The two big changes I made to the latest is - 1) generating the Users model/view/controller from Devise so I could customize. 2) Added a path prefix to the devise user paths (i.e. registration)
As a test on Heroku, change root_path to a different controller/index (i.e. messages_path), which allowed access to the application. Everything worked, except a click to the home link, which tries again to go to the users_path (same missing template error):
<%= link_to image_tag("homeIcon.png"), users_path, :method =>"GET", :id =>"menulink", :title => "Go Home." %>
I am desperate for any insight into this issue because I can't figure out what to do except not use Devise and Users this way on Heroku. Any and all ideas are greatly appreciated!
Thanks, Anne
(Note on research: Searched on the error message; similar issues, but nothing about failing to go to root_path of users#index, nothing related to Devise and Users customization causing error message; reviewed questions list proposed by stackoverflow engin)
Login output local development in eclipe:
Started GET "/" for 127.0.0.1
(0.2ms) SHOW search_path
Processing by UsersController#index as HTML
Redirected to [local-machine]/myprefix/users/sign_in
...
Started GET "/" for 127.0.0.1 at 2014-05-17 08:31:13 -0400
Processing by UsersController#index as HTML
User Load (0.3ms) SELECT "users".* FROM "users"
Login output on Heroku. Users sign-in, but users/index.html page causes “Sorry, but something went wrong” page.
Started GET "/myprefix/users/sign_in" for ...
heroku[router]: at=info method=GET path=/assets/application...dyno=web.1
Rendered devise/sessions/new.html.erb within layouts/application (53.2ms)
Processing by Devise::SessionsController#new as HTML
cache: [GET /myprefix/users/sign_in] miss
…
heroku[router]: at=info method=POST path=/myprefix/users/sign_in
host=myapp.herokuapp.com
…
Started POST "/myprefix/users/sign_in"
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓"...
Redirected to http://myapp.herokuapp.com/
cache: [POST /myprefix/users/sign_in] invalidate, pass
method=GET path=/ host=myapp.herokuapp.com request_id=f...
Processing by UsersController#index as HTML
Completed 500 Internal Server Error in 49ms
Started GET "/" for ...
ActionView::MissingTemplate (Missing template users/index, application/index
with {:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}.
Searched in:
ActionView::MissingTemplate (Missing template users/index, application/index with
{:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}.
Searched in:
* "/app/app/views"
* "/app/vendor/bundle/ruby/1.9.1/gems/devise-2.2.8/app/views"
):
cache: [GET /] miss
(no other output)
File.properties shows location (i.e. eclipse ide)
[path-to-my-rail-app]/app/views/users/index.html.erb
[path-to-my-rail-app]/app/views/layouts/application.html.erb
routes.rb
MyApp::Application.routes.do
devise_for :views
devise_for :admins
devise_for :users, :path_prefix => 'myprefix'
resources :users do
resources :x, only: [:new, :create, :index, :edit,:destroy]
resources :y, only: [:new, :create, :index, :update, :destroy]
resources :z, only: [:new, :create, :index, :edit,:destroy,:update] do
get :q, :on => :member
end
end
rake routes output:
new_user_session GET
/myprefix/users/sign_in(.:format)
{:action=>"new", :controller=>"devise/sessions"}
user_session POST
/myprefix/users/sign_in(.:format)
{:action=>"create", :controller=>"devise/sessions"}
destroy_user_session DELETE
/myprefix/users/sign_out(.:format)
{:action=>"destroy", :controller=>"devise/sessions"}
user_password POST
/myprefix/users/password(.:format)
{:action=>"create", :controller=>"devise/passwords"}
new_user_password GET
/myprefix/users/password/new(.:format)
{:action=>"new", :controller=>"devise/passwords"}
edit_user_password
GET
/myprefix/users/password/edit(.:format)
{:action=>"edit", :controller=>"devise/passwords"}
PUT /myprefix/users/password(.:format)
{:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration
GET /myprefix/users/cancel(.:format)
{:action=>"cancel", :controller=>"devise/registrations"}
user_registration POST /myprefix/users(.:format)
{:action=>"create", :controller=>"devise/registrations"}
new_user_registration GET
/myprefix/users/sign_up(.:format)
{:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET
/myprefix/users/edit(.:format)
{:action=>"edit", :controller=>"devise/registrations"}
PUT /myprefix/users(.:format)
{:action=>"update", :controller=>"devise/registrations"}
DELETE /myprefix/users(.:format)
{:action=>"destroy", :controller=>"devise/registrations"}
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"}
root /
{:controller=>"users", :action=>"index"}
gemfile: source 'http://rubygems.org' gem 'bundler' ruby "1.9.2" gem 'rails', '3.1.3' gem 'rails_12factor', group: :production gem 'pg' gem 'devise'
users_controller.rb:
class UsersController < ApplicationController
def index
@users = User.active_users
end
end
appliction.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'devise'