ruby on rails - Replacing :id from routes without breaking the convention -


i replaced :id on resource routes in rails 3 hash generated. i'm annoyed fact i'm writing less conventional code (e.g. link_to edit_user_path(@user) written link_to '/users/#{@user.user_hash}'). i'm wondering, therea smarter way this?

class user < activerecord::base   def to_param     user_hash   end end 

and edit_user_path(@user) work you


Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -