Simple parent object filter for polymorphic resource controllers. More info from Val Aleksenko and Davis Cabral
Example controller:
class CommentsController < ApplicationController
parent_resources :article, :document
def new
@parent = parent_object
@comment = Comment.new
end
def create
@parent = parent_object
@comment = @parent.comments.build(params[:comment])
if @comment.valid? and @comment.save
redirect_to send("#{ parent_type }_url", @parent)
else
render :action => 'new'
end
end
end