繁体   English   中英

调用模式时出现401未经授权的错误

[英]Getting a 401 Unauthorized error when calling a modal

我只是想调用一个模式来编辑产品,但被重定向了。 使用has_secure_password ..没有任何过滤器..我确实更改了模型中的键。

class Product < ActiveRecord::Base
  belongs_to :merchant, :foreign_key => 'merchant_identifier', 
  :primary_key => 'merchant_identifier'  
end

和我的商人模型..这是我的用户..除了验证之外,这里没有其他内容。

class Merchant < ActiveRecord::Base
  self.primary_key = 'merchant_identifier'
  has_many :products, :foreign_key => 'merchant_identifier', 
  :primary_key => 'merchant_identifier'
end

这是调用模式的link_to

<% @products.each do |product| %>
  <tr>
      <td><%= link_to "Edit", edit_product_path(product), remote: true, 
      class: "btn btn-primary btn-sm" %></td>
  </tr>

这是产品#edit

def edit
  @product = Product.find(params[:id])
end

我也在尝试调试它,但是代码只是从我的编辑动作中弹起,直接进入此错误。 知道如何更好地调试吗?

Processing by ProductsController#edit as JS
Parameters: {"id"=>"70"}
Completed 401 Unauthorized in 2ms

弄清楚了这个问题..它是一个环绕式过滤器,但是它在我使用的宝石中..所以它有点隐蔽..

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM