Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在敏捷 Rails 开发代码中看到了这段代码
line_items_path(:product_id => product)
并且无法弄清楚它是如何工作的。我可以看到它用于将产品添加到购物车,但是这个 _path 函数在这里是如何工作的?
您可以在config/route.rb中找到line_item_path指向的位置:product_id它是一个参数,然后您可以在line_item_path指定的函数中读取