1
這真令人沮喪。 AA過去對我來說效果很好,我想我已經嘗試了幾乎所有的東西。這是我的問題:Heroku上的ActiveAdmin - 路由不正常
在本地主機上,一切工作正常,但一旦我在Heroku,奇怪的事情發生。
我的儀表板有[Badge]
和[Student]
等等。
我可以通過/admin/badges
查看所有徽章。但是,一旦我做了編輯/視圖/顯示,Heroku上出現錯誤,而它在本地主機上正常工作。
在檢查,發生這種情況:
ActionView::Template::Error (No route matches {:action=>"edit", :controller=>"admin/students", :id=>#<Student id: nil, email: "", encrypted_password: "", password_salt: "", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, avatar_file_name: nil, avatar_content_type: nil, avatar_file_size: nil, name: nil, role: nil, school: nil, parent_tutor_email: nil, parent_tutor_token: nil, pending_badge: nil, proficiency: 0.0, created_at: nil, account_type: "free", chargify_id: nil, fb_id: nil, score: 0, level_id: nil, special_bonuses: nil, birthday: nil, edu_level: nil>}):
1: render renderer_for(:show)
似乎:id
應該是徽章ID,但它得到由學生對象,裏面是空的慘敗了。
這是我的route.rb文件:
WitsApp::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :students, :controllers => {:registrations => "registrations", :sessions => "students_sessions", :passwords =>"devise/passwords"} do
match 'students/sign_up' => 'registrations#create', :as => "student_sign_up"
get 'students/sign_out' => 'students_sessions#destroy'
get 'students/sign_in' => 'pages#welcome'
get 'students/password/new' => 'devise/passwords#new'
get 'students/password/edit' => 'devise/passwords#edit'
post 'students/password' => 'devise/passwords#create'
put 'students/password' => 'devise/passwords#update'
get 'students', :to => 'students#show', :as => :student_root
resources :badges
resources :students
end
match '/sign_up' => 'pages#welcome', :as => "sign_up"
root :to => "pages#home"
end
這裏是耙路線(截),如果有幫助:
admin_dashboard /admin(.:format) {:action=>"index", :controller=>"admin/dashboard"}
admin_comments GET /admin/comments(.:format) {:action=>"index", :controller=>"admin/comments"}
POST /admin/comments(.:format) {:action=>"create", :controller=>"admin/comments"}
new_admin_comment GET /admin/comments/new(.:format) {:action=>"new", :controller=>"admin/comments"}
edit_admin_comment GET /admin/comments/:id/edit(.:format) {:action=>"edit", :controller=>"admin/comments"}
admin_comment GET /admin/comments/:id(.:format) {:action=>"show", :controller=>"admin/comments"}
PUT /admin/comments/:id(.:format) {:action=>"update", :controller=>"admin/comments"}
DELETE /admin/comments/:id(.:format) {:action=>"destroy", :controller=>"admin/comments"}
admin_topics GET /admin/topics(.:format) {:action=>"index", :controller=>"admin/topics"}
POST /admin/topics(.:format) {:action=>"create", :controller=>"admin/topics"}
new_admin_topic GET /admin/topics/new(.:format) {:action=>"new", :controller=>"admin/topics"}
edit_admin_topic GET /admin/topics/:id/edit(.:format) {:action=>"edit", :controller=>"admin/topics"}
admin_topic GET /admin/topics/:id(.:format) {:action=>"show", :controller=>"admin/topics"}
PUT /admin/topics/:id(.:format) {:action=>"update", :controller=>"admin/topics"}
DELETE /admin/topics/:id(.:format) {:action=>"destroy", :controller=>"admin/topics"}
admin_badges GET /admin/badges(.:format) {:action=>"index", :controller=>"admin/badges"}
POST /admin/badges(.:format) {:action=>"create", :controller=>"admin/badges"}
new_admin_badge GET /admin/badges/new(.:format) {:action=>"new", :controller=>"admin/badges"}
edit_admin_badge GET /admin/badges/:id/edit(.:format) {:action=>"edit", :controller=>"admin/badges"}
admin_badge GET /admin/badges/:id(.:format) {:action=>"show", :controller=>"admin/badges"}
PUT /admin/badges/:id(.:format) {:action=>"update", :controller=>"admin/badges"}
DELETE /admin/badges/:id(.:format) {:action=>"destroy", :controller=>"admin/badges"}
admin_students GET /admin/students(.:format) {:action=>"index", :controller=>"admin/students"}
POST /admin/students(.:format) {:action=>"create", :controller=>"admin/students"}
new_admin_student GET /admin/students/new(.:format) {:action=>"new", :controller=>"admin/students"}
edit_admin_student GET /admin/students/:id/edit(.:format) {:action=>"edit", :controller=>"admin/students"}
admin_student GET /admin/students/:id(.:format) {:action=>"show", :controller=>"admin/students"}
PUT /admin/students/:id(.:format) {:action=>"update", :controller=>"admin/students"}
DELETE /admin/students/:id(.:format) {:action=>"destroy", :controller=>"admin/students"}
人有什麼想法?感謝您花時間!
當你從heroku控制檯內部運行「rake routes」時,你會得到什麼? –
嗨!rake路由輸出與heroku完全相同。 –