开发者

question about devise

开发者 https://www.devze.com 2023-01-26 16:56 出处:网络
In my dumy rails project, I use devise to provide the login/out and authentication function. But I need provide the virtual user more functionalities. for example upload his 开发者_C百科avatar picture

In my dumy rails project, I use devise to provide the login/out and authentication function. But I need provide the virtual user more functionalities. for example upload his 开发者_C百科avatar picture. Then problems comes. It seems that devise is confilict with the "mvc" principle, because I can't the expected user_controlle.rb , let's say I create a model user.rb.

My limited knowledge let me think like this: without the user controller I can't add the "upload avartar picture" action.

so could you tell me how to bypass the limitation of devise in my situation? thanks in advance.


Try this: https://github.com/plataformatec/devise/wiki/How-To:-Manage-users-through-a-CRUD-interface

Basically,

  1. Create a controller for your users
  2. Add resources :users to your routes.rb file, and make sure it's below the devise_for :users route
  3. Make sure you remove :registerable from your model, if it's there

Note: these instructions are for Rails 3. For Rails 2, the instructions in the link above should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消