Problem with generating view

Hello, I'm using Rails 3 and when I run this command:

rails generate controller Todos2

So I get new controller called Todos2 and in file todos2_controller.rb I will creating two view, index and about. (+ of course I'll creating appropriately views *.rhtml). Then when I type localhost:3000/todos - problem with routing, localhost:3000/todos/index - the same, localhost:3000/todos/about - the same

When I used Rails v2.3.4, I rebooted server and everything worked. But now, I'm using Rails 3 and unfortunately nothing.

And so: when creating controller and I'm typing:

rails generate controller Todos2 index2, about2

So both of views are created automatically and it seems work.

So I would like to ask you -- in Rails 3 is not possible to create views manually, only with using command?

Thanks a lot, M.

Hello, I'm using Rails 3 and when I run this command:

rails generate controller Todos2

So I get new controller called Todos2 and in file todos2_controller.rb I will creating two view, index and about. (+ of course I'll creating appropriately views *.rhtml). Then when I type localhost:3000/todos - problem with routing, localhost:3000/todos/index - the same, localhost:3000/todos/about - the same

When I used Rails v2.3.4, I rebooted server and everything worked. But now, I'm using Rails 3 and unfortunately nothing.

And so: when creating controller and I'm typing:

rails generate controller Todos2 index2, about2

So both of views are created automatically and it seems work.

So I would like to ask you -- in Rails 3 is not possible to create views manually, only with using command?

Probably because in a newly created rails 3 app the legacy default routes aren't enabled by default. Looks like the generator will setup the routes for you but if you're adding the extra actions yourself then you'll have to add them to your routes file too.

Fred

And where this set up can I to find? I see into the files in config directory but I'm not sure, what I have to change... :confused:

Have a look at the Rails Guide on routing. Also the guide on Getting Started probably. The free online tutorial at railstutorial.org will help to get you going also. Work right through that.

Colin

Hm... now I tried to create manually new action with view on new app and everything works... RoR kidding me!

For the others: except the creating action and view, you must the add adequate line to config/routes.rb. Then it should work.

No action will work unless there is an appropriate entry in routes.rb. In the console type rake routes to see what routes are currently configured.

If you still think that an action is being performed without a route then post routes.rb here and the url that you think is being routed without an entry.

Colin