0
votes

In my rails 3.2.2 app I have the following in my routes.rb:

scope "abc" do
   get "hello/index"
end

Which should link "/abc/hello/index" to my index-action in my hello-controller, right?

Instead, I get the error "uninitialized constant Abc"

If I change it to the following

scope "abc" do
   match "hello/index", to: "hello#index", via: :get
end

it works just fine.

From my understanding of the routing engine, the two should be the same, shouldn't they?

(See e.g.: http://guides.rubyonrails.org/routing.html#http-verb-constraints )

Also, if you do a "rails g controller hello index" a route named

get "hello/index"

is autocreated suggesting that this is the standard way of doing a non-restful get route.

So why can't I scope such a route? Any ideas?

1

1 Answers

0
votes

The examples are using the notation scope "/abc", maybe the initial / is required.