Topic: Routing oddity

Hi all,

I've got something weird happening with my rails app.

Locally (using webrick) my routes work fine. I have a controller named "Content" and I can happily type the following url : http://localhost:3000/content/view/12

Now, when I deploy the same app to my web host, I get a routing error. I fixed the problem by removing the very first line in ContentController.rb, which happened to be :

require 'lib/redcloth'

(and of course any further reference to the redcloth API)

So what's happening ? Why is the require statement messing things up ? Why aren't both applications behaving the same way ?

Thanks in advance for your answers.

Re: Routing oddity

Does your server have the redcloth gem installed? May want to try requiring that instead of lib/redcloth. Also, try placing it in environment.rb:

require 'redcloth'

Railscasts - Free Ruby on Rails Screencasts

Re: Routing oddity

No it's not, but it's not installed either on my development machine.
I've put the redcloth.rb file directly into the "lib" folder of my rails app, which works fine locally.

Also, the log does not report any error about not finding the redcloth library (which it did before because of another problem). Rather it says :

ActionController::RoutingError (Recognition failed for "/content")

Re: Routing oddity

That's strange, I don't see the connection between routing and redcloth. Perhaps the production environment just doesn't like loading redcloth inside the controller file. What happens if you load it in envirnoment.rb the same way you were in the controller? Do you still get the routing error? Do you get the same error on other controllers or just that one?

Railscasts - Free Ruby on Rails Screencasts

Re: Routing oddity

If I require redcloth from application.rb :

"Rails app failed to start properly"...

And I get the same error in all my controllers.

Kind of weird...

Re: Routing oddity

I guess redcloth isn't loading properly for some reason. Try removing the redloth loading completely, then running script/console on your server side. Load redcloth through there. See if you get an error with a stacktrace. If so, post that.

Railscasts - Free Ruby on Rails Screencasts