caarlos0
caarlos0

Reputation: 20633

Routes path helper method

I created a new route, like this:

  resources :animals do
    member do
      get ':id/resumed_rep_life', :action => 'resumed_rep_life'
    end
  end
  match '/animals/:id/resumed_rep_life' => "animals#resumed_rep_life"

How can I made a link for it?

I tried resumed_rep_life_animal_path(animal) but it does not work (method not found). Are my routing correct?

Upvotes: 3

Views: 761

Answers (1)

weexpectedTHIS
weexpectedTHIS

Reputation: 3376

Change this line:

match '/animals/:id/resumed_rep_life' => "animals#resumed_rep_life"

to this:

match '/animals/:id/resumed_rep_life' => "animals#resumed_rep_life", :as => 'resumed_rep_life_animal'

Upvotes: 4

Related Questions