Forum: Ruby on Rails Restful Polymorphic Post Path

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E98de78bb42013c488fe8aa9d77d2cb1?d=identicon&s=25 steve odom (Guest)
on 2007-06-23 01:30
(Received via mailing list)
Hi,

I'm trying to create a link_to_remote whereby it takes me to the
CREATE action of a polymorphic model (points). Ex:

<%= link_to_remote "up", :url => comment_points_path(item), :method
=> :post %>

That takes me to the show action in the points controller instead of
create.

The routing looks something like:
----
  map.resources :comments do |comment|
    comment.resources :points, :name_prefix => 'comment_'
  end
  map.resources :articles do |article|
    article.resources :points, :name_prefix => 'article_'
  end

---

Can I do this using a restful route or will I have to do it long hand
(:url => {:controller => "points", :action => "create", :comment_id =>
item.id }? I figure I've got something slightly off.

Thanks,

Steve
E98de78bb42013c488fe8aa9d77d2cb1?d=identicon&s=25 steve odom (Guest)
on 2007-06-23 13:58
(Received via mailing list)
Seems to be working now!
This topic is locked and can not be replied to.