I need a link, which would point to all jobs, tagged as PHP. This structure makes sense to me:
site.com/jobs/skills/php
How do I do this in Rails?
resources :jobs do
collection do
resources :skills, as: :find_by_skill
end
end
However, this does not work, when I try to call the jobs_find_by_skill(skill) helper. Where is a problem? If this cannot be done, could you suggest a better URL structure for this kind of purpose?
You mix up tags and skills here. I’m using tags for this answer.
The most common way would to make your url working would be nested resources
Remember not to put subsequent resources in collection or member blocks. Then have a tags_controller.rb like this for example
The corresponding association of Job and Tag needs to be there as well.
Hope that get you further.