Flowdock

Notes posted by mayurkhatri

RSS feed
July 23, 2014 - (v3.2.1)
0 thanks

form_for with namescope and polymorphic path

<%= form_for([:namescope_name, @object], :url => polymorphic_path([:namescope_name, @objectable, @object])) do |form| %>


for the routes.

namescope :admin do

resources :articles do
  resources :comments
end
resources :photos do
  resources :comments
end

end

<%= form_for([:admin, @comment], :url => polymorphic_path([:admin, @commentable, @comment])) do |form| %>

Note : @commentable = find_commentable