Ok so it turns out there is a known bug when you use created_at with Postgres. This is apparently going to be fixed in Rails 1.1. The annoying part about it was that it only shows up if you are not restarting your server all the time. Which means in development you probably won’t see it - but in production you will. Very annoying!
That being said it is a perfect oppotunity to talk about plugins. Plugins serve two different purposes:
The first, and probably most common, is to extend Rails in one way or another. This is basically adding new functionality to rails. Examples of this type abound - namely - acts_ad_taggable which makes it trivial to support tagging in your rails apps or Open Laszlo Plugin which builds a bridge from Rails to the Flash capabilities of Open Laszlo.
Basically the plugin allows Rails to do something it has never been able to do before. This is actually handy when you have base level concepts that you want to use across projects. I’m currently playing with a plugin that makes it seriously easy to respect referential integrity rules from the database in the model.
There is a second use for plugins - Monkey Patching! Basically you can use a plugin to modify the core in a way that can used for test purposes. Maybe the feature needs some more work before it can be added to the core. Or in my case - maybe there is a bug in the core and you don’t want to have to switch to Rails Edge to get it fixed.
Enter FixPgTimestamp Plugin. (Be gentle this is the very first time I’ve actually released any ruby out into the world. The code is mainly based on a simple post in the Rails bug system from mat@absolight.fr.I just bundled it up into a nice simple plugin.)
Basically this plugin fixes the problem with created_at date caching that currently effects the main version of Rails. To use it all you have to do is install it into your vendor/plugins directory and it will handle the rest. The best part is that when Rails 1.1 comes out and this fix is no longer needed you can simply delete the plugin and you won’t have to change any of your code. All in all pretty cool!
I didn’t really understand the power and usefulness of plugins until just a few days ago - and it turns out I learned about them just in the nick of time.
Update
Thanks to some help from Rich Olson I got a plugin server up and running. Now you can :
script/plugin install http://source.economysizegeek.com/svnroot/rails/pluginsfix_pg_timestamp
If you would prefer to keep up using an externals setting
script/plugin install -x http://source.economysizegeek.com/svnroot/rails/plugins/fix_pg_timestamp
Leave a Reply
Moderation Active: Old stuff here... Therefore your comment on this post will be moderated (i.e. don't submit twice !)