Okay so right now I have this as a route:
map.connect 'browse/:cal_name', :controller => 'browse', :action =>
If the :cal_name has spaces in it (Test Calendar) for example, then the
url appears as Test+Calendar in the url. Is there a way to substitute
something else (say '-' or something) for the '+' in the url?
I'd mix things up a little bit. I'm going to assume some things about your model names, but that's not the important part
class Calendar < ActiveRecord::Base
# assuming the following columns: id:integer, name:string
Then change your route to this:
map.browse_calendar 'browse/:calendar', :controller => 'browse', :action => 'events_listing'
Then in your controller do this:
@calendar = Calendar.find(123) # assuming id=123 is 'Test Calendar'
And in your view do this:
<%= link_to 'Browse', browse_calendar_path(:calendar => @calendar) %>
That should result in a URL such as:
If for some reason doing the substition in that to_param() method fails
you will get:
In either case you can then use that information in your events_listing
action to retrive the calendar using:
You could also change the to_param() method to not put the "123-" at the
beginning, but would then need to tweak your finding later on to look
for either an id or a calendar name.
Hope this helps,