Countdown

  • No dates present

StockTwits - All Updates

Loading...

Montreal on Rails – 1st event

0
Digg me

Ruby on Rails enthusiasts in Montreal met at the MAAS Chemistry building at McGill university this Tuesday for the first edition of Montreal on Rails. The event, organized by Carl Mercier and Mat Balez of Karabunga, was packed and featured one advanced presentation and an easier one. And fresh donuts.

Marc-André Cournoyer – Making API testing more efficient. InActiveRecord

First, Marc-André Cournoyer, from StandoutJobs delivered a high-pace presentation about how to make API-testing with Ruby and Ruby on Rails more efficient. The introduction was hilarious, with choice illustrations accompanying Marc-André’s quick and witty delivery in sync.

MA showed explained how testing can last too long when you are accessing APIs through the net, especially with many different tests. So as to ease development and testing, MA proposed that fixtures and tests\mocks within the Rails project could be used to get a local cache of the results of API queries and from then on, the tests could be edited so that the local file could be accessed instead based on the setting of an environment variable (REAL_REQUEST in his example).

MA showed re-building using Rake and CruiseControl to specify the special build with the REAL_REQUEST variable.

His demonstrations concerned the Twitter API, and the results before and after the implementation of the mock tests using the cache file were:

Before: 3.73 seconds for all tests
After: 0.06 seconds

This is extremely useful, and combined with, say an RSS feed on the API blog to be aware of any API change (in which case you’d need to refresh your cache file once), makes for efficient testing.

In the second part of his presentation, MA showed InActiveRecord, a DSL for ActiveRecord, which is built on top of mockups so as to enable caching of data instead of database access and thus make testing faster in these cases too.

In true open-source spirit, MA has put his code online. His presentation is available too.

During the presentation, MA performed some on-the-spot refactoring through the code. He evidently has great chops programming Ruby and RubyonRails, and the Standout Jobs team did well to get him on board.

Carl Mercier – HAML

Carl did a short and informative presentation about HAML, a markup language by Hampton Catlin which produces other markup languages. HAML exists as a plugin to Rails (you can also use it from Ruby) and enables you to replace the .rhtml files.

Why would you do that? Because HAML is much more compact and easy to read and write and therefore using it speeds up your Rails development when specifying your views. HAML does not need closing tags, and relies on 2-space indentation for block definition – very reminiscent of Python. In addition, HAML intelligently relies on ‘convention over configuration’ by defaulting to a div tag.

Example: these two are identical in HAML:
%small{:class=>’code’, :id=>’message’}
%small.code#message

Ruby code can run directly in HAML too.

Another example Carl showed was:


%head = {:name=> 'dochead'}

%ul
- @users.each do |user|
%li[user]=user.name
- end

As an aid to speed up development, HAML is very useful. However, Carl mentioned that current performance is 30% slower than ERB (dynamic ruby inline of HTML).

After this there were talks of SASS, which is the equivalent of HAML but for CSS.

Derek: “Can you define your own tags?”
Carl (hacking up some HAML):




Audience member: “But…what does it do?”
Carl:”I don’t know… It eats donuts.”

Montreal on Rails, 1st edition, was great. Introductory presentation of Rails for businesses would be interesting too in next editions. The event is planned to be a monthly one. TextMate on Mac really rocks as a development tool.

- MA has his own account of the event online.
- The event debrief is at the Montreal on Rails site.

And thanks for the donuts.

  • Wow! Thanks for the great review Josh. Amazing summary of both presentations, I could not have done better, even for mine!

    See you there next time!
  • Josh
    Cheers Marc-André. Nice meeting you there. Wicked programming skills too.
blog comments powered by Disqus