Rails acts_as_rateable plugin... 2

Posted by Steve Longdo Thu, 09 Feb 2006 19:25:00 GMT

I've gotten quite a bit done on rating. Models can now use the act_as_rateable plugin to track rating information. I've written ActionView Helpers to implement a star rating system and a very cool 1..10 style bar. I've done some preliminary studying of integration with the sciptaculous_slider rails plugin as well.

Remaining todo items include:
  • Rake task to copy images the helpers use to public/images directory.
  • Rake task to setup database tables for storing rating info.
  • Convert the SQL file I've been using into a Migrations style script.
  • Increase Unit Testing coverage.
  • Tying in a rate method on ActionControllers...
This last item is giving me pause though. I was wanting to include a simple rating_controller with the plugin and have it automatically register its route via the init.rb file. I sought out help from the Rails mailing list, but no one could help helped. I may pursue a rake task for adding the route into the routes.rb file. I think this isn't nearly as cool as self-registering a route within the init.rb file, but I haven't had any luck with the methods I have tried so far.

Update: Everytime I post about progress I have made here I find something wrong in my code. I need to re-examine how the view gets updated, somewhere along the way I broke this...
Read more...

Polling/Rating latest...

Posted by Steve Longdo Thu, 02 Feb 2006 03:24:00 GMT

Work has been slow going on my polling plugin. My day job has been sapping my energy for working on Rails projects when I get home.

That said I have been able to solve some of the issues I posted about earlier and some progress has been made. I have given the code for the Horizontal CSS bar graph to topfunky to include in his CSSGraphs plugin. I finally was able to get poll results to show up in the Typo sidebar. My local verison of Typo is severly hacked to accomplish this. Unfortunately this makes the polling code difficult to distribute. I have decided to rethink my entire approach to the project.

I am going to rewrite polling as a Rails engine to better facilitate code sharing and obviate the need for a hacked verison of Typo. I will make some sort of Typo integration with the polling engine available. Perhaps even making the polling information available through a web service. Before I do any of that though, I want to add a stripped down version of polling as a rating plugin for Rails. Rating will be implemented in the style of the acts_as_* ActiveRecord mixins. A model would have acts_as_rateable and the table would need a rating_id column. I have detailed this a bit better on my projects page. I may have to pursue rating as an engine since there would need to be some sort of rating input widget. The experiment continues...