43

In my routes.rb I have:

get "projects/:category_id" => "projects#index"

When I write projects_path(1) the generated URL is /projects.1 instead of /projects/1. Do you know why this is happening? Here is the output of rake routes:

 GET /projects/:category_id(.:format) projects#index
nmat
  • 7,430
  • 6
  • 30
  • 43
  • possible duplicate of [Rails creating malformed routes with dots](http://stackoverflow.com/questions/14033853/rails-creating-malformed-routes-with-dots) – inye Apr 21 '14 at 02:55
  • duplicate of http://stackoverflow.com/questions/5674116/path-helpers-generate-paths-with-dots-instead-of-slashes – Beau Smith Mar 08 '16 at 01:15
  • 1
    Possible duplicate of [Path helpers generate paths with dots instead of slashes](https://stackoverflow.com/questions/5674116/path-helpers-generate-paths-with-dots-instead-of-slashes) – Jon Schneider Oct 05 '17 at 17:18

1 Answers1

104

projects_path is the index, which only takes one argument: the format. You want project_path(1)

numbers1311407
  • 33,686
  • 9
  • 90
  • 92