<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coffee Powered &#187; plugin</title>
	<atom:link href="http://www.coffeepowered.net/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coffeepowered.net</link>
	<description>code and content</description>
	<lastBuildDate>Mon, 09 Jan 2012 18:32:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>site_config &#8211; painless custom configuration for your Rails project</title>
		<link>http://www.coffeepowered.net/2008/09/25/site_config-painless-config-variables-for-rails-projects/</link>
		<comments>http://www.coffeepowered.net/2008/09/25/site_config-painless-config-variables-for-rails-projects/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 11:31:59 +0000</pubDate>
		<dc:creator>Chris Heald</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.coffeepowered.net/?p=14</guid>
		<description><![CDATA[site_config is a little plugin that addresses a problem lots of people seem to need to solve in their Rails apps: per-environment configuration variables. It&#8217;s very simple, but makes configuration dead-easy. To install it: script/plugin install git://github.com/cheald/site_config.git Once you have it installed, check out config/site_config.yml &#8211; there&#8217;s your config file. You&#8217;ll notice that it has [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/cheald/site_config/tree/master">site_config</a> is a little plugin that addresses a problem lots of people seem to need to solve in their Rails apps: per-environment configuration variables.</p>
<p>It&#8217;s very simple, but makes configuration dead-easy. To install it:</p>
<pre><code>script/plugin install git://github.com/cheald/site_config.git</code></pre>
<p>Once you have it installed, check out <code>config/site_config.yml</code> &#8211; there&#8217;s your config file.</p>
<p>You&#8217;ll notice that it has some dummy data in there to begin with. It&#8217;s much like your <code>database.yml</code> file; just specify the environment, and under that, specify the key:value pairs you want to have available in your app. site_config has one little trick up its sleeve, though &#8211; the key &#8220;inherit&#8221; is special, and tells it to pull values from another environment. This helps you DRY up your configs, and makes it quite easy to maintain.</p>
<p>For example, if you had the following <code>site_config.yml</code>:</p>
<pre class="brush: ruby; title: ; notranslate">
development:
  page_title: &quot;my development site&quot;
  admin_user: chris

production:
  inherit: development
  page_title: &quot;my production site&quot;
</pre>
<p>You can then use those configured values in your site like so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;title&gt;&lt;%=config_option :page_title %&gt;&lt;/title&gt;
Your friendly admin is &lt;%=config_option :admin_user %&gt;
</pre>
<p>site_config will pull values defined for your current environment. If you don&#8217;t have a value defined for a given environment, but do have an <code>inherit</code> defined, site_config will then look to the inherited config to pull values from.</p>
<p>Additionally, if you want a value from a specific environment, <code>config_option</code> accepts a second parameter, which specifies the environment to pull from.</p>
<pre class="brush: ruby; title: ; notranslate">
config_option :page_title, :development
</pre>
<p>There&#8217;s more at the github page. Check it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coffeepowered.net/2008/09/25/site_config-painless-config-variables-for-rails-projects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

