Posted over 7 years ago. Visible to the public.

Multi-line Ruby block in Haml

There are several options, but most of them are impractical. The best way is to use the :ruby filter:

Copy
:ruby puts javascript_include_tag( 'lib/jquery-1.6.1.min.js', 'lib/jquery-rails-ujs.js', 'lib/jquery-ui-1.8.13.custom.min.js', 'lib/jquery.ui.datepicker-de.js', 'lib/jquery-ui-timepicker-addon.min.js', 'lib/jquery.tools.min.js', 'application.js', 'google-maps.js', :cache => true )

Note that you need to use puts to pipe text into the response. From the Haml reference:

All output sent to $stdout, like with puts, is output into the Haml document.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Henning Koch
Last edit:
almost 7 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more