Associations and to_json on collections of objects

ActiveRecord’s Serialization module does provide to_json method. It allows include associations when dumping to JSON, but it works only for single objects. If You want to run it against collection, returned by find :all You will get: >> Model.all.to_json :include =>:association TypeError: wrong argument type Hash (expected Data) from (irb):13:in `to_json’ from (irb):13 If You …

GMarkerManager and setImage – why it fails?

I wrote simple howto about changing icons in markers when markers is already placed on map. And I was asked question about setImage and GMarkerManger. Problem is that when changing image with setImage old image will be displayed when user zooms map in or out – when GMarkerManager is used to place markers on map. …

Don’t use array as argument for AJAX call with Prototype

I’m using Prototype JavaScript library and today I have learned one thing. To make Your life easier do not use JavaScript Arrays as arguments for AJAX calls. I’m talking about parameters option in Ajax objects (Ajax.Request, Ajax.Updater, etc). Let’s take simple HTML snippet (public/test.html): <div id=”out”></div> <script src=”/javascripts/prototype.js” type=”text/javascript”></script> <script type=”text/javascript”> addr = [] addr[1] …

Embedded maps with routes

RNS got updated again. Now it allows to embed on other webpages maps with routes created with RNS. So if You want to present Your last bike trip, morning jogging route or provide directions how to get to Your place for example from airport – You have now tool. Just go to RNS site, register …