I am trying to link to action addData in the entries controller. I have constructed the link like this:
<%= link_to image_tag (w.link, :border =>0) ,:controller => :entries, :action => :addData %>
but when I click on the link, I get this error:
Couldn't find Entry with ID=addData
I’m pretty sure this is because I have a restful design. Is there a way around this problem? Thanks for reading.
Rails has migrated wholly to a RESTful design. This means that in order to use non standard actions you have to add them to your resources in
config/routes.rb.If they operate on all resources you add them to the hash
:collection => {:addData => :post}In case you have one operating on a single resource with an id use
:member.To some it up for you.
To use the old style of mapping any action to any controller you can add the following two lines to your
config/routes.rb