Hi i have this starnge behavoir…
<%= link_to image_tag("image.png"), brain_path(1), :method => "put" %>
produces:
<a href="/brain.1" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.met ...[many rails code]... ;return false;"><img alt="Research_4" src="/images/image.png" /></a>
a href=”/foobar.1″ this is the strange part 🙁 any ideas whqt is causing this?
rake routes gives the following:
new_brain GET /brain/new(.:format) {:controller=>”brains”, :action=>”new”}
edit_brain GET /brain/edit(.:format) {:controller=>"brains", :action=>"edit"}
brain GET /brain(.:format) {:controller=>"brains", :action=>"show"}
PUT /brain(.:format) {:controller=>"brains", :action=>"update"}
DELETE /brain(.:format) {:controller=>"brains", :action=>"destroy"}
POST /brain(.:format) {:controller=>"brains", :action=>"create"}
How do you route your foobar? (singular or plural? resource or resources?)
Are you sure that you’re using
foobar_path(1), notfoobars_path(1)(singular form)in real life
foobars_path(1)will return /foobars.1 andfoobar_path(1)– /foobar/1as I see you have to use
brain_path(1)notbrain_path(1)UPD
Change your route.rb
it will be better if you’ll rename your controller into pluralize brains – it is more conventional when you are using resources