user938363
user938363

Reputation: 10350

How to pass rails route as parameter to controller?

I would like to pass a rails route as parameter to controller as variable, so the Back button knows where to back. Tried to include :previous_page => route_path as parameter for link_to. However it caused an error in index page display.

  def edit_cust?(cust, previous_page)
    return link_to 'Edit', edit_customer_path(cust, :previous_page => previous_page) if has_edit_right?(cust)
  end 

Any suggestions? Thanks.

Upvotes: 0

Views: 281

Answers (1)

Thilo
Thilo

Reputation: 17735

You can just use this:

link_to "back", :back

Upvotes: 1

Related Questions