Advent links

Well, I recommend two links for Ruby and Rails fan. Advent like calendars but instead of chocolate nice Ruby and Rails tips.

From other things – exactly as Amazon has predicted two books I’ve ordered, have arrived here to Poland. I’m impressed with delivery date prediction, polish companies could learn a lot from Amazon. Anyway, during Christmas Holidays, when I will be off the net (probably! between Christmas and New Years Eve) I have something to read, JavaScript: The Definitive Guide for start and Ruby Cookbook (Cookbooks (O’Reilly)) for later. I will write my review of those books, when I’m done.

JavaScript templates – Minus Mor plugin

First we need to install plugin:

cd  rails_app_directory
./script/plugin install

Now we can use in views new kind of files .ejs templates. They are just like .rhtml, but instead of embedding Ruby code in HTML, You use JavaScript as an native language, and insert Rails/Ruby code with well known <%= and <% tags. This tags work as in RHTML.

So what for it is useful? RJS templates are useful, but they are focused on AJAX (or at least this my perception of RJS) and sometimes is handy to create plain JavaScript code generated from Rails. For example to use controller actions to generate JS code as external scripts (for <script> tag). You can try emulate it with send_data function, but my practice shows there can be some obstacles (

So Minus Mor is plugin which solves all this problems. Continue reading

RNS – update

Last night I have deployed next RNS version, this time it is 0.214.

I have fixed stupid bug with storing coordinates of last visited location in cookie. I have used minus sign as separator between numbers (like 51.223-21.23-11 where last number is zoom level). As far I have tested it in Europe it was fine, since it was resulting with positive getCenter results (latitude and longitude). When someone look for map in US, where longitude is below zero, regular expression for extracting data from cookie went nuts, resulting with not displaying any map.

I discovered this bug when someone made first route in US.

From other changes, route editing now allows to delete points from route. I still work on adding new points, but as for now I have no idea how to accomplish this task (from UI perspective) to be simple and intuitive.