rails routing difference between v3 and V5

Liesl

I have to migrate a Rails app from 3.0.6 to 5.0 and am stuck - in the older routes.rb the only route was the ill advised:

match ':controller(/:action(/:id(.:format)))'

The application has no index method but does use an index.html.erb that puts up a form that renders to:

<form accept-charset="UTF-8" action="simple/rslts" controller="simple"     method="post">

This executes a rslts method that uses rslts.html.erb and works using parameters passed in from the form.

I move this exact same code to the v5 system and specify the routes as:

Prefix Verb URI Pattern       Controller#Action
simple GET  /simple(.:format) simple#index
       POST /simple(.:format) simple#rslts
  root GET  /                 welcome#index"

It runs the index.html.erb and I get this in the rendered form:

<form controller="simple" action="simple/rslts" accept-charset="UTF-8"    method="post">

It fails saying it can't find a route for /simple/simple/rslts

I change the code and now render:

<form controller="simple" action="rslts" accept-charset="UTF-8"     method="post">

It fails saying it can't find a route for /simple/rslts but as you can see from the routes I listed that does exist.

I have munged this around a dozen ways and read the routing guide with no enlightenment. This is only controllers and views, nothing else. I hope someone can help me.

Owen
  1. Re: /simple/simple/rslts: Your action attribute is just "simple/rslts" which is relative to the current URL. You'll need to prepend a slash, e.g. action="/simple/rslts".
  2. The route /simple/rslts is not defined according to your rake routes output: the right-hand side that says simple#rslts is the controller and action name, not part of the URL (which is on the left and has an optional format specifier). Instead you have defined that POST /simple should direct to the rslts action. You'll need to add a route for /simple/rslts or change the action (again) to post directly to /simple.

post '/simple/rslts' => 'simple#rslts'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

What is the difference between <%, <%=, <%# and -%> in ERB in Rails?

From Java

Difference between string and text in rails?

From Dev

difference between scaffold and model in Rails

From Dev

What is the difference between the Rails datatypes?

From Dev

Ruby on Rails whenever + capistrano v3 integration

From Dev

Difference between actions and filters in rails

From Dev

Sharing routing concerns between rails engines

From Dev

Switch between panes in Pharo v3

From Dev

Google Maps API v3: Why are there inconsistencies between my search results by Google Maps API V3 and Google Maps?

From Dev

Is there a difference between this: value and this => value in Rails?

From Dev

Rails: Difference between 'in?' and 'include?' in Rails

From Dev

Difference between ("v" 1) and ("v" . 1)

From Dev

Difference between v1, v2 and v3 in https://www.googleapis.com/oauth2/v3/certs

From Dev

Spray: routing - understand the difference between path and pathPrefix

From Dev

Behaviour of Join-Path cmdlet between Powershell v4 and v5

From Dev

Angular 2 Child Routing (v3) 'Cannot read property 'annotations' of undefined'

From Dev

rails How to calculate time difference with integer between 3 dates

From Dev

What is the difference between :to and => in rails

From Dev

Routing differences between Kohana v2 and v3

From Dev

what changes in routing were made between Rails 3 and Rails 4?

From Dev

Ruby on Rails whenever + capistrano v3 integration

From Dev

Rails : Send email with Mailjet Api V3

From Dev

Difference between <%= ... %> and <% ... %> Ruby on Rails

From Dev

Behaviour of Join-Path cmdlet between Powershell v4 and v5

From Dev

What is the difference between resources and namespace in rails nested routing

From Dev

SAPUI5 Routing - Difference between controlId and targetControl

From Dev

Ruby / Rails / v5 - Routing Order - Root - Does the location of root mater in regards to the order on routes file?

From Dev

Is there a Rails Gem for the Microsoft Cognitive Services Image Search API - V5?

From Dev

Difference between " / " and " ./ " in laravel routing?

Related Related

  1. 1

    What is the difference between <%, <%=, <%# and -%> in ERB in Rails?

  2. 2

    Difference between string and text in rails?

  3. 3

    difference between scaffold and model in Rails

  4. 4

    What is the difference between the Rails datatypes?

  5. 5

    Ruby on Rails whenever + capistrano v3 integration

  6. 6

    Difference between actions and filters in rails

  7. 7

    Sharing routing concerns between rails engines

  8. 8

    Switch between panes in Pharo v3

  9. 9

    Google Maps API v3: Why are there inconsistencies between my search results by Google Maps API V3 and Google Maps?

  10. 10

    Is there a difference between this: value and this => value in Rails?

  11. 11

    Rails: Difference between 'in?' and 'include?' in Rails

  12. 12

    Difference between ("v" 1) and ("v" . 1)

  13. 13

    Difference between v1, v2 and v3 in https://www.googleapis.com/oauth2/v3/certs

  14. 14

    Spray: routing - understand the difference between path and pathPrefix

  15. 15

    Behaviour of Join-Path cmdlet between Powershell v4 and v5

  16. 16

    Angular 2 Child Routing (v3) 'Cannot read property 'annotations' of undefined'

  17. 17

    rails How to calculate time difference with integer between 3 dates

  18. 18

    What is the difference between :to and => in rails

  19. 19

    Routing differences between Kohana v2 and v3

  20. 20

    what changes in routing were made between Rails 3 and Rails 4?

  21. 21

    Ruby on Rails whenever + capistrano v3 integration

  22. 22

    Rails : Send email with Mailjet Api V3

  23. 23

    Difference between <%= ... %> and <% ... %> Ruby on Rails

  24. 24

    Behaviour of Join-Path cmdlet between Powershell v4 and v5

  25. 25

    What is the difference between resources and namespace in rails nested routing

  26. 26

    SAPUI5 Routing - Difference between controlId and targetControl

  27. 27

    Ruby / Rails / v5 - Routing Order - Root - Does the location of root mater in regards to the order on routes file?

  28. 28

    Is there a Rails Gem for the Microsoft Cognitive Services Image Search API - V5?

  29. 29

    Difference between " / " and " ./ " in laravel routing?

HotTag

Archive