Rails 看 ruby-china 源码中关于 Devise 的疑问

dothide · February 20, 2014 · 1844 hits

最近在入门 ruby-china 源码,在 account/new.html.erb 中 simple_form_for(resource, :as => resource_name, ...)

其中斜体的 resourceresource_name 是哪儿冒出来的啊?翻遍 devise 也没找到 不知该怎么理解。

如果我这么理解:是在 route 中定义了 devise_for :users 因此这个 resource 就默认指的是 user 对象,那么 resource_name 又是什么?况且如果有多个的话 devise_for :admins 那 resource 指向的又是谁呢?

有点迷茫 >.<

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.