使用Devise和ActiveAdmin快速切换用户

时间:2011-09-27 15:21:38

标签: ruby-on-rails ruby-on-rails-3 devise activeadmin

我按照本文在Devise中创建了快速用户切换:

http://pivotallabs.com/users/mbarinek/blog/articles/1387-fast-user-switching-with-devise

我不明白的是,在黄瓜文件中,它说

"And I follow the "Sign in as" link for user: "bob"". 

但是当我运行rake路线时没有sign_in_as_path。

我正在使用activeadmin,当我尝试使用addiitional“sign in as”字段生成Admin / users视图时:

  column "Sign In As" do |user|
      link_to "Sign in As", :controller => "signinas", :action => "create"
  end

这在路线中:

  match "/admin/signinas/create"   => "SignInAs#create"    

它给了我这个:

ActionController::RoutingError (uninitialized constant SignInAsController::SignInAs):
  app/controllers/sign_in_as_controller.rb:2:in `<class:SignInAsController>'
  app/controllers/sign_in_as_controller.rb:1:in `<top (required)>'

我不知道如何在文章中指定的SignInAsController中触发admin / users.rb中的create操作,其中包含:

ActiveAdmin.register User do
  index do
    column :email
    column :name
          column "Sign In As" do |user|
      link_to "Sign in As", :controller => "signinas", :action => "create"
  end
  end
end

感谢您的回复

0 个答案:

没有答案