Ok, I tried it now, you wonβt need it:
def to_param "#{id}/#{slug}" end
In routes.rb (replace what you want with what you need)
match "/expenses/:id/:slug" => "expenses#show", :as => :expense
Your link_to should now look like this:
= link_to "something", expense_url(:id => expense.id, :slug => expense.slug)
hope this helps a little
source share