Rails添加设计新动作

时间:2016-02-16 04:08:58

标签: ruby-on-rails devise

我正在尝试在我的设计注册控制器中添加一个新操作,但是找不到错误路由。我之前没有这样做过,所以也许我犯了错误。我在我的注册控制器上添加了索引操作。我有使用devise创建用户模型。获取错误没有路由匹配[GET]“/ users / registrations”
[registrations_controller]

class Users::RegistrationsController < Devise::RegistrationsController
# before_filter :configure_sign_up_params, only: [:create]
# before_filter :configure_account_update_params, only: [:update]

  # GET /resource
  def index
    @users=User.all
    redirect_to index_path
  end

  # GET /resource/sign_up
  # def new
  #   super
  # end

  # POST /resource
  # def create
  #   super
  # end

  # GET /resource/edit
  # def edit
  #   super
  # end

  # PUT /resource
  # def update
  #   super
  # end

  # DELETE /resource
  # def destroy
  #   super
  # end

  # GET /resource/cancel
  # Forces the session data which is usually expired after sign
  # in to be expired now. This is useful if the user wants to
  # cancel oauth signing in/up in the middle of the process,
  # removing all OAuth session data.
  # def cancel
  #   super
  # end

  # protected

  # If you have extra params to permit, append them to the sanitizer.
  # def configure_sign_up_params
  #   devise_parameter_sanitizer.for(:sign_up).permit(:attachment)
  # end

  # If you have extra params to permit, append them to the sanitizer.
  # def configure_account_update_params
  #   devise_parameter_sanitizer.for(:account_update) << :attribute
  # end

  # The path used after sign up.
  # def after_sign_up_path_for(resource)
  #   super(resource)
  # end

  # The path used after sign up for inactive accounts.
  # def after_inactive_sign_up_path_for(resource)
  #   super(resource)
  # end

end


[路由]

 devise_for :users, controllers: {
        sessions: 'users/sessions',
        registrations: 'users/registrations'
        #get 'users/registrations'
      }

  devise_scope :user do
  get 'registrations/index', :action => 'index', :controller => 'registrations'
  end

0 个答案:

没有答案