ruby on rails - Using inherited_resources for nested, polymorphic comments -
i new using inherited resources , want use polymorphic nested comments. have several objects commentable (articles, galleries, etc.) , comments can nested. i'm using combination of awesome_nested_set (parent_id, lft, rgt) comment model having polymorphic commentable columns. the controller needs receive ajax request (only) create action , perform below: posting /articles/12/comments/34 creates comment commentable equal @article (12) , parent equal @comment (34) /articles/12/comments/34 posting /gallery/12/comments/34 creates comment commentable equal @gallery (12) , parent equal @comment (34) i'm bit stuck on begin. use case inherited resources? class commentscontroller < inheritedresources::base respond_to :js, :only => :create belongs_to :article, :cheat, :gallery, :video, :polymorphic => true belongs_to :comments end def create create! |format| # how in here build comment handles polymorphism? @...