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.
我在我的控制器中放置了一个随机化定义,并希望通过一条宁静的路线来访问它。应该通过以下方式访问该路线:
<%= link_to "Randomize", random_reader_path %>
但我无法弄清楚如何让这条路线出现在 rake 路线中或在我的 routes.rb 文件中正确配置它。
random 方法将与 index 做同样的事情,只提供一个随机页面内容 @variable
目前我有我的读者控制器作为
resources :reader
在我的 routes.rb
添加更多 RESTful 操作!
resources :reader do get 'random', on: :collection end
不过,路线将是random_readers_path。
random_readers_path