On May 30, 2006, at 4:04 PM, Charlie Bowman wrote:

Charlie, I'm afraid I don't understand. How would it know to build /pragmatic/ index from {:controller => "pragmatic", :action => "index"}, when you've connected it to ''? You can't have one route that maps to two paths, I'm afraid. - Jamis

That's what I thought. I spent quite a long time trying to figure out the long url, but resorted to doing this in my routes.

  map.connect '/pragmatic/', :controller =>  "pragmatic"
  map.connect '', :controller => "pragmatic"

It works, but page caching is now broken with the the url "my_app.com/pragmatic". When I call url_for(:controller => 'pragmatic') it returns '/pragmatic/' instead of ''. My plugin works for all controllers now, but if you browse to my_app.com/ pragmatic/ you will not receive the cached version. If I browse to "my_app.com", I do get the cached page. I'm sure this is caused by my duplication in the routes, but it's a necessary evil that I'll live with to make page expiration easier. For now I just don't worry about caching "my_app.com/pragmatic/". My plugin allows me to expire all pages under a particular controller or controller/ action combo. If I allow url_for to return ' ', then my expire method would delete the entire public folder if that is where the cached pages were stored. That's why I was looking for an easy method that would return the long url.

Could you just have the '' url redirect to the cached url?

- Jamis

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to