[Rails] URL rewriting

softwareengineer 99 softwareengineer99 at yahoo.com
Wed Feb 8 16:41:43 GMT 2006


I believe you don't need URL rewriting for this.
  
  I was trying to something similar so instead of 
  http://domain.com/post/id
  it will use http://domain/post/title
  
  and I ended up using something like:
  
  map.connect 'post/:mytitle', :controller => "yourController", :action => 'show'
  
  Look around in routes.rb file.
  
  Hope this helps.
  
  Frank

Kevin <khillabolt at gmail.com> wrote:  Here is the scenario I am trying to achieve. Basically, I want to run
the action "show" from my controller, without adding the "show/id".

Standard:
http://www.domain.com/controllerName/show/id

I would like:
http://www.domain.com/controllerName/randomstring (where randomstring is 
a
field in my model/table, that is equivalent to a GUID -> and unique).

I'm confused at how this would be possible, because you normally would
create an action in the controller, that is then used in the url.
Would this be a URL rewrite that would need to be added to .htaccess?
If so, the I would have to some how change the "show" action to not
use "id"?

Thanks for any help you can provide.

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails at lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails


		
---------------------------------
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060208/d7d775b5/attachment.html


More information about the Rails mailing list