Hobo Cookbook

View Source



DRYML’s ‘if’ test


<if test="¤t_user.administrtator?">Logged in as administrator</if>
<else>Logged in as normal user</else>

IMPORTANT NOTE: <if> tests for non-blank vs. blank (as defined by ActiveSuport), not true vs. false.

If you do not give the test attribute, uses the current context instead. This allows a nice trick like this:


This has the double effect of changing the context to the this.comments, and only evaluating the body if there are comments (because an empty collection is considered blank)

Show Source


No comments to display