Posted by Steve Longdo
Fri, 06 Jan 2006 18:52:00 GMT
I've been working on a polling plugin for
Typo. Initially I've been including it as a sidebar plugin, but now I am not sure if this is the way to distribute it. The code itself doesn't really need to be tied to the sidebar model even though it started out that way.
I am not sure what exactly the best way is to package it though.
Rails provides for a component mechanism that may be a more appropriate way to distribute the polling code, but I am uncertain of the specifics of being able to add database tables for components or their lifecycle in general. I need to spend more time researching this.
The sidebar mechanism in
Typo makes adding the tables fairly straight forward, but I wonder how things will work down the line for future updates to the plugin. Also I haven't found the hook in the sidebar for when a sidebar block is removed. Seems like I should remove the associated polling tables when someone removes the poll from their sidebar.
Which leads me to another candidate for distribution which would be to make the polling available as an ActiveRecord mixin. Similar to how the Touch mixin in the
TimeStamp class works with the created_on and updated_on columns. The Pollable? mixin could require model objects to include a poll_id column or something or perhaps add acts_as_pollable. That way you could associate the poll with individual articles instead of just putting a single poll in the sidebar. I still would need to add the tables used for storing the polling information however. So I am not sure that this is right either.
<plea>Does anyone with Rails knowledge have any guidance for me?</plea>