Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails:Spree:使用自己的用户表进行身份验证_Ruby On Rails_Ruby_Ruby On Rails 4_Spree - Fatal编程技术网

Ruby on rails Rails:Spree:使用自己的用户表进行身份验证

Ruby on rails Rails:Spree:使用自己的用户表进行身份验证,ruby-on-rails,ruby,ruby-on-rails-4,spree,Ruby On Rails,Ruby,Ruby On Rails 4,Spree,我的数据模型中有自己的用户表,我想对用户进行身份验证 我已经阅读了Spree页面上的身份验证信息,并按照步骤进行了操作 然而,我在这方面遇到了麻烦,因为它似乎是与spree用户而不是我的用户一起工作的应用程序 这里是routes.rb上的design_范围 devise_scope :usuario do get '/login', :to => "devise/sessions#new" get '/signup', :to => "devi

我的数据模型中有自己的用户表,我想对用户进行身份验证

我已经阅读了Spree页面上的身份验证信息,并按照步骤进行了操作

然而,我在这方面遇到了麻烦,因为它似乎是与spree用户而不是我的用户一起工作的应用程序

这里是routes.rb上的design_范围

    devise_scope :usuario do
        get '/login', :to => "devise/sessions#new"
        get '/signup', :to => "devise/registrations#new"
        delete '/logout', :to => "devise/sessions#destroy"
    end
如果我对其中一条路径进行注释,则登录仍然有效

身份验证\u helpers.rb:

    module Spree
       module AuthenticationHelpers
         def self.included(receiver)
           receiver.send :helper_method, :spree_login_path
           receiver.send :helper_method, :spree_signup_path
           receiver.send :helper_method, :spree_logout_path
           receiver.send :helper_method, :spree_current_user
         end

       def spree_current_user
          current_usuario
       end

       def spree_login_path
          main_app.login_path
       end

       def spree_signup_path
         main_app.signup_path
       end

       def spree_logout_path
          main_app.logout_path
      end
   end
end
ApplicationController.send:include,Spree::AuthenticationHelpers

和初始化者提供的spree.rb:

   # Configure Spree Preferences
   #
   # Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
   #       If you would like users to be able to update a setting with the Admin it should NOT be set here.
   #
   # In order to initialize a setting do:
   # config.setting_name = 'new value'
   Spree.config do |config|
  # Example:
  # Uncomment to override the default site name.
       config.site_name = "Smarket"
       config.logo = "store/smarket.png"
   end

    Spree.user_class = "Usuario"

              Rails.application.config.to_prepare do
                require_dependency 'spree/authentication_helpers'
              end

我应该如何处理我自己的表格,以及如何更改登录和注册表单?

我刚刚根据在我的用户模型上执行了相同的操作,没有任何问题。你确定你遵循了所有的步骤吗

至于更改表单,spree登录只是使用designe默认登录过程,因此您需要将designe表单复制到您的应用程序中并在其中进行编辑。请参阅上的说明