调用模态时得到401未授权错误

Getting a 401 Unauthorized error when calling a modal

本文关键字:授权 错误 模态 调用      更新时间:2023-09-26

我只是想调用一个模态来编辑一个产品,但被重定向。使用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>

This is Products#edit

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

我正试图调试这个,但代码只是跳出我的编辑动作,直接到这个错误。我怎么能更好地调试这个吗?

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

找到问题了。这是一个周围的过滤器,但它是在宝石我正在使用…所以它有点隐藏。