Custom routes with rails 3.1 -


i'm trying application show url follows: example.com/42/jessica-alba current routes line(not sure if it's correct)

match '/:id/:name' => 'models#show'     

for reason if type example.com/42/gvkodjgj030 it'll still shw me user id 42, regardless of text after /

another thing i'm trying accomplish link_to tags of user point example.com/42/jessica-alba instead of example.com/users/42

please me out guys, first rails app :)

*edit: first part working snippet i've pasted, still need fix 2nd part though.

in routes.rb

  `match '/:id/:name' => 'models#show', :as => :show_model' 

in models/show.html.erb code,

  <%=link_to "show", show_model_path(:id => 2, :name => "some name") 

does work?


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -