我有一个为 Devise 创建的控制器,我想用它在 /devise/registration/ 中添加更多页面
class RegistrationsController < Devise::RegistrationsController
skip_before_filter :detect_account_ended
def import
@title = "Import customers from Quickbooks"
end
def categories
@title = "Edit Categories"
@categories = current_user.categories
respond_to do |format|
format.html # index.html.erb
format.json { render json: @categories }
end
end
protected
def after_update_path_for(resource)
edit_user_registration_path
end
end
我创建了路线
devise_for :users,
:path_names => {
:sign_up => "register",
:destroy => "logout" },
:controllers => {
:registrations => :registrations } do
get '/users/sign_out' => 'devise/sessions#destroy'
get '/users/import' => 'devise/registrations#import'
get '/users/categories' => 'devise/registrations#categories'
end
和意见。视图正确显示,但我从注册控制器传递的对象不会进入视图。我该如何解决这个问题,以便将这些对象传递给我的视图?