I have released new RNS version (0.251). From user perspective, there should be no difference in functionality. Site should be much more faster, since I have implemented caching in RNS code (fragment caching to be exact).
After few days I will post here some numbers, how rendering times have changed. I hope it will be now faster ;)))
I was using acts_as_taggable DHH’s plugin. But I have moved to gem based one. After changing my database scheme and making code changes I ran across issue. When I was updating routes with tags ActiveRecord have dumped following error:
ActiveRecord::StatementInvalid (Mysql::Error: Duplicate entry '9' for key 1: INSERT INTO routes_tags (`tag_id`, `id`, `route_id`) VALUES (9, 9, 46)):
I was digging two nights and… long story short – there has to be no primary index on table holding bindings between tags and objects (here:
This morning I have released to public next RNS version (0.241). This is rather major update – routes can be tagged (using Rails act_as_taggable plugin), browsed by tags, routes can be also browsed by user owning them.
Go and check new features. When route is displayed, owner name is link to page with all routes from this user, tags on this page are also links to pages with routes by tag.
Now I need to add more search and browse features, RSS feed with new routes and comments to users/routes. And at this stage I plan to slow down with RNS development.
With famous DRY, I have written a bunch of common checks from RNS to some helpers methods. And I have to find some way to access them both from templates (RHTML) and controllers.
Rails provides two places to hold common helpers. First is
app/controllers/application.rb, parent for all controllers. Methods defined in this class will be accessible for all controllers in Your application. Second one place is
app/helpers/application_helper.rb. Methods defined there will be accessible for all RHTML templates.
But I see no simple way to write this in one place. Well it could be placed somewhere in
lib directory and included by
environments.rb, but I’m not sure if changes in such code would be automatically reloaded in development mode.
Methods from controllers can be accessed from template via
controller variable (like this:
controller.isOwner(@route)), but this is too verbose. So for now I use following approach – I define real code in
app/controllers/application.rb) and in
appplication_helper.rb I define simple wrapper for each method I have defined in
This time it was migrations crash course….
Recently I had to change run-n-share database structure and remove some models. I needed to find easy way to do changes in DB and make data transformation. Of course I started doing it with migrations.
Quite successfully. With one exception.