Yeah, I want to have common functionality.
Last night I worked on the problem a bit more using the existing schema (it's a big job to change the schema and update all the foreign keys in the comments table).
I came up with a RESTful URL scheme for posting comments:
/comments/new/:type/:id
For example, if you POST a comment to /comments/new/journal/256, it will take "journal" as the type, and use it like so:
@obj = params [:type].camelize.constantize.new.find(params [:id])
This retrieves the correct object to add the comment to, so then I just call
@obj.comments.build(params [:comment])
This is a partial solution to the problem. Gives me a central place to add comments to topics.
I'm still not happy with it overall, though. I mean, it works, but it's really not the cleanest solution.
thats a pretty neat way of doing it. very DRY, but maybe a bit hack-ish. but if it keeps the code tight, it could be a good thing.