<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://bridgetownrb.com/" version="2.2.2">Bridgetown</generator><link href="https://peterboling.com/feed/dry_views.xml" rel="self" type="application/atom+xml" /><link href="https://peterboling.com/" rel="alternate" type="text/html" /><updated>2026-11-15T23:03:36+00:00</updated><id>https://peterboling.com/feed/dry_views.xml</id><title type="html">Peter Boling | Dry_views</title><subtitle>Yet Another Paradigm by Peter Boling, featuring technical blog posts about Ruby, JavaScript, TypeScript, Go, Python, DevOps, and various open source projects. Ramblings, mumblings, cv/resume, technical blog, and documentation for many popular, and unpopular, RubyGems and other FLOSS projects, including oauth2, omniauth-identity, sanitize_email, debug_logging, flag_shih_tzu, gem_bench, etc. Semi-lifely state-of-the-petris updates.</subtitle><author><name>Peter Boling</name><email>floss@galtzo.com</email></author><entry><title type="html">dry_views v0.0.2 released!</title><link href="https://peterboling.com/dry_views/dry_views-v0.0.2-released!/" rel="alternate" type="text/html" title="dry_views v0.0.2 released!" /><published>2025-06-01T00:40:40+00:00</published><updated>2025-06-01T00:40:40+00:00</updated><id>https://peterboling.com/dry_views/dry_views-v0.0.2-released!/</id><content type="html" xml:base="https://peterboling.com/dry_views/dry_views-v0.0.2-released!/">&lt;p&gt;&lt;strong&gt;Full Changelog&lt;/strong&gt;: https://github.com/pboling/dry_views/compare/v0.0.1…v0.0.2&lt;/p&gt;</content><category term="release" /><category term="dry_views" /><category term="v0.0.2" /></entry><entry><title type="html">Introducing dry_views</title><link href="https://peterboling.com/dry_views/introducing-dry_views/" rel="alternate" type="text/html" title="Introducing dry_views" /><published>2012-08-15T19:30:16+00:00</published><updated>2012-08-15T19:30:16+00:00</updated><id>https://peterboling.com/dry_views/introducing-dry_views/</id><content type="html" xml:base="https://peterboling.com/dry_views/introducing-dry_views/">&lt;h2 id=&quot;enhancer-of-rails-content_for-system--allows-defaults-and-no_content_for-overrides-in-partials--for-rails-3-4&quot;&gt;Enhancer of Rails’ content_for system.  Allows defaults, and no_content_for overrides in partials.  For Rails 3, 4.&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/pboling/dry_views&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/rt/dry_views.svg&quot; alt=&quot;Total Downloads&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/dry_views&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/rd/dry_views.svg&quot; alt=&quot;Downloads Today&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://codeclimate.com/github/pboling/dry_views&quot;&gt;&lt;img src=&quot;https://img.shields.io/codeclimate/github/pboling/dry_views.svg&quot; alt=&quot;Code Quality&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/dry_views/network&quot;&gt;&lt;img src=&quot;https://img.shields.io/github/forks/pboling/dry_views.svg?style=social&quot; alt=&quot;Network&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://github.com/pboling/dry_views/stargazers&quot;&gt;&lt;img src=&quot;https://img.shields.io/github/stars/pboling/dry_views.svg?style=social&quot; alt=&quot;Stars&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://rubygems.org/gems/dry_views&quot;&gt;&lt;img src=&quot;https://img.shields.io/gem/v/dry_views.svg&quot; alt=&quot;Version&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://travis-ci.org/pboling/dry_views&quot;&gt;&lt;img src=&quot;https://img.shields.io/travis/pboling/dry_views.svg&quot; alt=&quot;Build&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;http://inch-ci.org/github/pboling/dry_views&quot;&gt;&lt;img src=&quot;http://inch-ci.org/github/pboling/dry_views.svg&quot; alt=&quot;Documentation&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://depfu.com/github/pboling/dry_views?project_id=2680&quot;&gt;&lt;img src=&quot;https://badges.depfu.com/badges/6a3ae8aaafecea73df9ade7213788b22/count.svg&quot; alt=&quot;Depfu&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://gitter.im/pboling/dry_views&quot;&gt;&lt;img src=&quot;https://img.shields.io/gitter/room/pboling/dry_views.svg&quot; alt=&quot;Chat&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://opensource.org/licenses/MIT&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/License-MIT-green.svg&quot; alt=&quot;License: MIT&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;why&quot;&gt;Why?&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Keep the views dry with content_for_with_default and friends!&lt;/li&gt;
  &lt;li&gt;Complete flexibility in defining defaults and overrides.&lt;/li&gt;
  &lt;li&gt;Remove most or all logic from views.&lt;/li&gt;
  &lt;li&gt;Allow for no content to override a default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DryViews provides extensions to ActionView&lt;mark&gt;Helpers&lt;/mark&gt;CaptureHelper, which is part of ActionPack:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;content_for_with_default&lt;/li&gt;
  &lt;li&gt;no_content_for&lt;/li&gt;
  &lt;li&gt;content_for (enhanced to play nice with the above methods)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rails rendering chain is sort of inside out so the template rendering happens first, and this is what makes it possible to override everything! The template will ALWAYS override the layout, and a partial will always override a partial layout.&lt;/p&gt;

&lt;p&gt;Here are some guidelines for using the code below with HAML (see the &lt;a href=&quot;https://github.com/pboling/dry_views/wiki/ERB-Usage-Example&quot;&gt;wiki for ERB examples&lt;/a&gt;):&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- no_content_for :key
# Use a dash (-) not equals (=)
# Will prevent a later content_for from rendering.  This allows template overrides of layouts.

= content_for_with_default :key
# Use an equal (=) not a dash (-)
# You provide it with the default HAML via a block *or* a set of params that are the same as you would pass to a standard &quot;render&quot; call (i.e. :partial =&amp;gt; &apos;foo&apos;, :locals =&amp;gt; {:bar =&amp;gt; &apos;bar&apos;}).

= content_for :key
# Use an equal (=) not a dash (-)
# You provide it with a block, i.e. {render :partial =&amp;gt; &apos;foo&apos;}, and it will override content_for_with_default.  It has the same precedence as no_content_for, so whichever is rendered first wins, so if a layout has either no_content_for or content_for (with or without default) the template can now override it.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;

&lt;p&gt;Add this line to your application’s Gemfile:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gem &apos;dry_views&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And then execute:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ bundle
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or install it yourself as:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ gem install dry_views
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;

&lt;p&gt;Example #1:
in a layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- no_content_for :breakfast                 # ARROWED!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in a template&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for :breakfast do                 # WINNER!
  %h1 Dub Step
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will have Dub Step&lt;/p&gt;

&lt;p&gt;Example #2:
in a layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for :breakfast do                 # ARROWED!
  %h1 Dub Step
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in a template&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- no_content_for :breakfast                 # WINNER!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will have NOTHING&lt;/p&gt;

&lt;p&gt;Example #3:&lt;/p&gt;

&lt;p&gt;in a layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for :breakfast do                 # WINNER!
  %h1 Dub Step
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in a template&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for :breakfast do                 # WINNER!
  %h1 Metal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will have Dub Step and Metal (Concatenation!)&lt;/p&gt;

&lt;p&gt;Example #4:
in a layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for_with_default :breakfast do    # ARROWED!
  %h1 Dub Step
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in a template&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for :breakfast do                 # WINNER!
  %h1 Metal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will have Metal only (No Dub Step!)&lt;/p&gt;

&lt;p&gt;Example #5:&lt;/p&gt;

&lt;p&gt;in a layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for_with_default :breakfast do    # ARROWED!
%h1 Dub Step
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in a template&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- no_content_for :breakfast                 # WINNER!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will have NOTHING&lt;/p&gt;

&lt;p&gt;Example #6:
in a layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for_with_default :breakfast do    # ARROWED!
  %h1 Dub Step
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in a template&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= render :partial =&amp;gt; &apos;hip_hop&apos;, :layout =&amp;gt; &apos;sample&apos;
= no_content_for :breakfast do              # ARROWED!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in the ‘sample’ partial layout&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= no_content_for :breakfast do              # ARROWED!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in the ‘hip_hop’ partial&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;= content_for :breakfast do                 # WINNER!
  %h1 Hip Hop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will have Hip Hop only (No Dub Step!)&lt;/p&gt;

&lt;h2 id=&quot;contributing&quot;&gt;Contributing&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Fork it&lt;/li&gt;
  &lt;li&gt;Create your feature branch (&lt;code class=&quot;highlighter-rouge&quot;&gt;git checkout -b my-new-feature&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Commit your changes (&lt;code class=&quot;highlighter-rouge&quot;&gt;git commit -am &apos;Added some feature&apos;&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Push to the branch (&lt;code class=&quot;highlighter-rouge&quot;&gt;git push origin my-new-feature&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Create new Pull Request&lt;/li&gt;
&lt;/ol&gt;</content><category term="development" /><category term="ruby" /><category term="rails" /><category term="rubygems" /><category term="dry_views" /></entry><entry><title type="html">Introducing dry_views</title><link href="https://peterboling.com/dry_views/introducing-dry_views/" rel="alternate" type="text/html" title="Introducing dry_views" /><published>2012-08-14T00:00:00+00:00</published><updated>2012-08-14T00:00:00+00:00</updated><id>https://peterboling.com/dry_views/introducing-dry_views/</id><content type="html" xml:base="https://peterboling.com/dry_views/introducing-dry_views/">&lt;p&gt;ZERO LOGIC VIEWS ARE POSSIBLE!&lt;/p&gt;

&lt;p&gt;| Project                 |  DryViews    |
|———————— | —————– |
| gem name                |  dry_views   |
| license                 |  MIT              |
| expert support          |  | download rank               |  | version                 |  | homepage                |  [on Github.com][homepage] |
| documentation           |  [on Rdoc.info][documentation] |
| Spread ~♡ⓛⓞⓥⓔ♡~      |  &lt;a href=&quot;https://about.me/peter.boling&quot;&gt;🌏&lt;/a&gt;, 
[semver]: http://semver.org/
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
[railsbling]: http://www.railsbling.com
[peterboling]: http://www.peterboling.com
[coderbits]: https://coderbits.com/pboling
[coderwall]: http://coderwall.com/pboling
[documentation]: http://rdoc.info/github/pboling/dry_views/frames
[homepage]: https://github.com/pboling/dry_views&lt;/p&gt;

&lt;h3 id=&quot;getting-started&quot;&gt;Getting Started&lt;/h3&gt;

&lt;p&gt;For more information and detailed examples, please visit the &lt;a href=&quot;https://github.com/galtzo-floss/dry_views&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;supporting-this-project&quot;&gt;Supporting this Project&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://opencollective.com/galtzo-floss&quot;&gt;OpenCollective&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://git.sr.ht/~galtzo/dry_views&quot;&gt;SourceHut&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><category term="introduction" /><category term="dry_views" /></entry></feed>