If I wanted to use a friendly url, say, http://www.something.com/my-url, how would I go about doing that? I can''t define an action my-url, and I don''t want to clutter my routes up... Is there a way to do this? -- Posted via http://www.ruby-forum.com/.
On 6/5/06, Ken Kam <kenkam@gmail.com> wrote:> If I wanted to use a friendly url, say, http://www.something.com/my-url, > how would I go about doing that? I can''t define an action my-url, and I > don''t want to clutter my routes up... > > Is there a way to do this?Yes, by routes. Not sure what you mean by clutter... Joe
I use this: map.connect '':id'', :controller => "pages", :action => ''view'' Which allows URLs to be simple like http://www.mysite.com/123... ...where 123 is the ID sent to the view action of the pages controller. On 6/5/06, Joe Van Dyk <joevandyk@gmail.com> wrote:> > On 6/5/06, Ken Kam <kenkam@gmail.com> wrote: > > If I wanted to use a friendly url, say, http://www.something.com/my-url, > > how would I go about doing that? I can''t define an action my-url, and I > > don''t want to clutter my routes up... > > > > Is there a way to do this? > > Yes, by routes. Not sure what you mean by clutter... > Joe > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060605/95c21c5a/attachment.html
Joe Van Dyk wrote:> On 6/5/06, Ken Kam <kenkam@gmail.com> wrote: >> If I wanted to use a friendly url, say, http://www.something.com/my-url, >> how would I go about doing that? I can''t define an action my-url, and I >> don''t want to clutter my routes up... >> >> Is there a way to do this? > > Yes, by routes. Not sure what you mean by clutter... > JoeIf I have a lot of urls that I would like to do a - instead of a underscore, wouldn''t that take a lot of lines? -- Posted via http://www.ruby-forum.com/.
Not sure what you mean, can you please clarify? On 6/5/06, Ken Kam <kenkam@gmail.com> wrote:> > Joe Van Dyk wrote: > > On 6/5/06, Ken Kam <kenkam@gmail.com> wrote: > >> If I wanted to use a friendly url, say, http://www.something.com/my-url > , > >> how would I go about doing that? I can''t define an action my-url, and I > >> don''t want to clutter my routes up... > >> > >> Is there a way to do this? > > > > Yes, by routes. Not sure what you mean by clutter... > > Joe > > If I have a lot of urls that I would like to do a - instead of a > underscore, wouldn''t that take a lot of lines? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060606/2dfbb4bf/attachment.html