Writing new controllers

I have created new rails-project.
I start Mongrel.

I add to project:

app/controllers/my_first_controller.rb

class MyFirstController < ApplicationController
def index
render :text => ‘My First Controller’
end
end

http://192.168.1.1:8080/my_first/ → all OK!

Then, I add:

app/controllers/my_second_controller.rb

class MySecondController < ApplicationController
def index
render :text => ‘My Second Controller’
end
end

I open:
http://192.168.1.1:8080/my_second/

And I have error:
No route matches “/my_second/” with {:method=>:get}

Why?

P.S.: Tested under Mongrel, Thin, Passenger, fastcgi

I work in development-mode.
My routes.rb:

ActionController::Routing::Routes.draw do |map|
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end

On Tue, Sep 2, 2008 at 2:50 PM, veejar [email protected] wrote:

I work in development-mode.
My routes.rb:

ActionController::Routing::Routes.draw do |map|
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end
–~–~---------~–~----~------------~-------~–~----~

I guess you need to restart your server :wink:


Staf Wagemakers - http://www.wagemakers.be

But why? It’s inconveniently!

But I write not new route. I write new controller.

routes.rb is cached for performance reasons, this might be the
problem…


Staf Wagemakers - http://www.wagemakers.be

2008/9/2 veejar [email protected]

Do you restart your project when you added the “my_second_controller” ?

The Route will be initialized at start.

2008-09-02

zheng.cuizh

发件人: veejar
发送时间: 2008-09-02 20:41:24
收件人: Ruby on Rails: Talk
抄送:
主题: [Rails] Writing new controllers

I have created new rails-project.
I start Mongrel.

I add to project:

app/controllers/my_first_controller.rb

class MyFirstController < ApplicationController
def index
render :text = > ’ My First Controller

' end end

http://192.168.1.1:8080/my_first/ - > all OK!

Then, I add:

app/controllers/my_second_controller.rb

class MySecondController < ApplicationController
def index
render :text = > ’ My Second Controller

' end end

I open:
http://192.168.1.1:8080/my_second/

And I have error:
No route matches “/my_second/” with {:method= >:get}

Why?

P.S.: Tested under Mongrel, Thin, Passenger, fastcgi

–~–~---------~–~----~------------~-------~–~----~
You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~–~—