Helperful 0.3.0

Last week I released a new minor version of the Helperful GEM. This is essentially a bugfix release, although it comes with one minor new feature: the javascript_content_for tag. The following overview is taken directly from the documentation.

The javascript_content_for helper combines the features of content_for and javascript_tag into a single helper.

erb <% javascript_content_for :head do %> $("#id").hide(); <% end %>

The block is passed as it is to javascript_tag, then the result is stored as content_for :head.

Now you can call yield and output your javascript content.

erb <%= yield :head %> <script>$("#id").hide();</script>

This example is equal to the following statements.

erb <% javascript_content_for :head do; javascript_tag do %> $("#id").hide(); <% end; end %> <% javascript_content_for :head do %> <script>$("#id").hide();</script> <% end %>

This feature also addresses an annoying bug in the has_content helper method caused by an undefined variable.

To install or upgrade:

bash gem install weppos-helperful --source

More features still to come. Visit the project page for further details.