I have articles, profiles, and comments. There is a polymorphic association between articles/profiles and comments called commentable.
On success creating a new comment I return to the commentable parent object with a sucess flash and I would like to do the same with the appropriate error flash on validation errors.
What should I pass to render?
def create
@commentable = find_commentable
@comment = @commentable.comments.build(params[:comment])
if @comment.save
flash[:notice] = "Successfully created comment."
redirect_to @commentable
else
render '??path_to_commentable_object_show??'
end
end
I guess I could build the path by grabbing the commentable class name and lowercasing it... but that seems awkward.