rails 4 - 强制路由中的两个参数

时间:2015-11-02 10:25:06

标签: ruby-on-rails-4 routes

我想在' routes.rb'。中创建网址 我有一个资源' Source'和source_controller有'索引'方法。
为了达到' index',我希望用户插入一个包含两个参数的网址:

源/ {类型} / {IDS} /索引

我在路线中写的代码有效:

resources :sources, param: :types, :only => :index do
                member do
                    get ':ids/index' => 'source#index'
                end
            end

它有效,但有没有办法以更优雅的方式做到这一点? (以某种方式将id添加到资源中)

0 个答案:

没有答案