Sunday, June 24, 2007

Rails 1.2.x routing issues

I have just developed my first real-world Rails 1.2 application and was happy to deploy it on my shared hosting server for testing purposes.

I was realy upset to see that the app didn't work! Just the basic login url /admin/login which should map using the basic route to :controller => "admin/login", :action => "index" thrown an error on me!

no route found to match ”/admin/login” with {:method=>:get}


What the heck? I worked on localhost! Apparently I am not the only one who is experiencing this problem.

The forum linked above gives many suggestions. I tried the most easy one:

- go to config/boot.rb
- change 8 to match this:

root_path = Pathname.new(root_path).cleanpath(true).realpath.to_s


Magicaly everything works now. If you happen to know why this helps, let me know in the comments. I am too tired to digg now.

UPDATE:

As I have seen on other places this solution does not work for everyone. For most people re-installing rails helped.

gem uninstall rails
gem install rails


Sadly this is not an option for me on a shared hosting. Maybe unfreeze&freeze?

0 comments: