RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

Mapping URLs in Rails

I just blogged about mapping urls in Rails explaining how to create restful routes when you want route names to be different from model names.

Comments

I would not put `:url=> "/add"` hard-coded like that. It will break if you deploy your rails app at a suburi, it also is another place you need to change if you decide to change your routes from /add to something else (say, you want to internationalize it so it uses the spanish word for 'add' in the url or something).

The Rails way to do this is with a routing method alias, or a hash, describing _what you want to do_, and let the rails routing translate that to a URL -- if the routing changes, your view doesn't have to.

:url => {:controller => 'book_reviews', :action => "create"}

or

:url => book_review_create_path()jrochkind - October 09, 2012 22:37
When it became clear Coach Factory Online about midnight that President Barack Obama was safely on Louis Vuitton Belt the way to re-election, a handful of cranky and Coach Outlet Store inebriated Republican donors wandered about Gucci Belt Romney's election night headquarters, angrily demanding that the Coach Factory Outlet Online giant television screens inside the ballroom be switched from CNN Coach Factory Store to Fox News, where Republican strategist Karl Rove was Coach Factory Online making frantic, face-saving pronouncements about Coach Factory Outlet how Ohio was not yet lost.But the signs of Coach Outlet Online desperation inside the Boston Convention and Coach Bags Outlet Exhibition Center on Tuesday night were symptomatic of a Republican Party Coach Factory Online now standing at a crossroads, with not much track in sight.Romney lost Coach Factory Outlet Online embarrassingly among young people, African-Americans and Hispanics, a brutal Coach Outlet Online reminder for Republicans that their party is ideologically out of tune with Coach Factory Outlet fast-growing segments of the population.Obama crushed Romney among Hispanic Hermes Belt voters by a whopping 44 points, a margin of victory that Coach Factory Online likely propelled the president to victories in Nevada, Colorado and possibly Florida.yaya - November 09, 2012 01:31
This outlet sells various high end rolex replica. Among our replicas, the Rolex Daytona watches are hot. The Rolex Daytona rolex replica uk is one of the most iconic watches at this online store. This rolex replica watches is scratch free. It looks bright and rich. The unique style is accentuated by great expertise.jamess - December 22, 2012 04:41

Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!