Reputation: 5308
I've seen calls to functions like
edit_person_path(person)
results_poll_path(poll)
But I can't replicate that to a path I've added
routes.rb
match 'proposals/:id/forkIt', :to => 'proposals#forkIt
And have forkIt_proposal_path(proposal)
So, i wanted to know, how do I achieve that.
P.S.: I'm noob to Ruby, sorry.
Upvotes: 1
Views: 743
Reputation: 2562
You haven't set the route name. This should do the trick:
match 'proposals/:id/forkIt', :to => 'proposals#forkIt', :as => 'forkIt_proposal'
Or slightly more succinct:
match 'proposals/:id/forkIt' => 'proposals#forkIt', :as => 'forkIt_proposal'
Upvotes: 4
Reputation: 12564
you should have a look to http://guides.rubyonrails.org/routing.html#adding-more-restful-actions (section 2.9 "adding more restful actions".)
not sure of what i say (im a noob too) but i think that path helpers are only created when you declare restful routes with resources() (in your case, add an action on member)
Edit: actually, the guide do state that path helpers are created doing this.
Upvotes: 0