I have this controller called activities, which contains methods, such as updateweight, displaycalories, etc.
<ul>
<li><%= link_to "Home", "/" %></li>
<li><%= link_to "Update Weight", "/activities/upweight" %></li>
<li><%= link_to "Food Ressources", "/activities/food_res" %></li>
<li><%= link_to "Exercises Technics", "/activities/exercises" %></li>
</ul>
Which route would be able to get to the activities controller and to the method with the name that comes after? I’ve tried ressources :activities, but I’m getting bizarre results.
Thanks for helping
Handling any arbitrary action in a controller is non-RESTful. Much older rails versions handled this like:
.. and in fact that’s still possible with Rails today. You should be careful not to mix RESTful and arbitrary actions in a single controller since actions like ‘create’ and ‘delete’ should not respond to GET requests.
Alternatively you could promote ‘weight’, ‘foods’ and ‘exercises’ to their own resources.
Also, you apparently can’t spell ‘resources’ or ‘techniques’ though I rather like the image of exercising one’s technics.