:as in rails routes.rb

后端 未结 3 1439
情书的邮戳
情书的邮戳 2020-12-04 15:12

In config/routes.rb, I tried both:

root :to => \'things#index\', :as => \'things\'

and

root :to => \'         


        
3条回答
  •  没有蜡笔的小新
    2020-12-04 16:08

    The :as option creates a named path. You can then call this path in your controllers and views (e.g. redirect_to things_path). This isn't very useful for the root path (as it already named root), but is very useful for new routes you add.

提交回复
热议问题