2
我爲我的應用安裝了RailsAdmin,但無法進入管理面板。授權後,我有路由錯誤:rails_admin路由錯誤
Routing Error
No route matches [GET] "/admin"
Try running rake routes for more information on available routes.
/config/routes.rb
1.mount RailsAdmin::Engine => '/adminpanel', :as => 'rails_admin'
/config/initializers/rails_admin.rb
1.RailsAdmin.config do |config|
2. config.authorize_with :cancan
3.end
/app/models/ability.rb
1.class Ability
2. include CanCan::Ability
3. def initialize(user)
4. if user.class.to_s == "Admin"
5. can :access, :rails_admin
6. can :manage, :all
7. elsif user.class.to_s == "User"
8. can :manage, :read
9. end
10. end
11.end
另外我有管理模式
/app/models/admin.rb
class Admin < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :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
但是,如果我在routes.rb中添加此:
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
我有循環轉發。
請幫我解決這個問題。
你運行「耙路線」的建議? – Vidya