0

We have shifted a project to Rails4 from Rails3 but some routes are not working.

Our previous route for rails 3 was

match 'moon-signs' => 'promotions#moon_portal', :as => :moon_portal_promotions

which used to work for both GET and POST requests. Now we have changed routes according to Rails4 conventions and above route has become:

match 'moon-signs' => 'promotions#moon_portal', :as => :moon_portal_promotions, :via => [:get, :post]

Now our above route works for 'GET' method but doesn't work for 'POST' method. And rake routes show following route for above

moon_portal_promotions GET|POST /moon-signs(.:format) promotions#moon_portal

4

1 回答 1

1

找到了解决方案,但没想到会是问题所在。

上面有以下变化的路线对我有用。

匹配 '/moon-signs' => 'promotions#moon_portal', :as => :moon_portal_promotions, :via => [:get, :post]

只有在匹配中添加/才能解决此问题。

于 2013-09-13T12:17:58.897 回答