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.
鉴于我已经在config/routes.rb
config/routes.rb
resource :products
如果我想访问路由助手,例如product_path(self)在模型中生成 url。我怎么能把这些模块混在一起呢?
product_path(self)
class MyClass < ActiveRecord::Base include Rails.application.routes.url_helpers end
或(不包含)
Rails.application.routes.url_helpers.product_path(self)