lundi 11 mai 2015

Rails 3 helper for match route

In a rails 3 application following match route is defined in routes.rb

match 'accounts/:account_type/:account_id/edit_account' => 'accounts#edit_account'

In controller i redirect to this URL

redirect_to "/accounts/account/#{account_id.to_s}/edit_account"

It works fine but i need a route helper instead of manually building the URL something like this

edit_account_accounts_path(account_id: id, account_type: 'some_type')

Is there any way to do this ?

Aucun commentaire:

Enregistrer un commentaire