Topic: wants.html redirect is giving me problems!

Ok, let's say I have a specific URL:

http://localhost:3000/show/this-permalink

I need to keep this exact URL, since I use the permalink for functionality in other parts of my code. When I use this code:
respond_to do |wants|
      wants.html { redirect_to :action => 'show',
                              :permalink => @commentid.permalink }
      wants.js  {  render  }
      end

It makes my URL:
http://localhost:3000/show?permalink=this-permalink

Is there anyway to fix this? My application crashes when this URL is the current URL, and the user tries to use other parts of the application that requires that specific permalink.

Re: wants.html redirect is giving me problems!

Do you have a custom route for this permalink? If you make it a named route you can use a method to generate the url instead like this:

# routes.rb
map.comment "/show/:permalink", #...

# controller
wants.html { redirect_to comment_path(@commentid.permalink) }

Railscasts - Free Ruby on Rails Screencasts

Re: wants.html redirect is giving me problems!

ryanb - thanks a bunch!

Works like a charm.