<?xml version="1.0" encoding="iso-8859-2"?>
<!-- name="generator" content="pyblosxom/1.0.0 (May 24, 2004)" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
<channel>
<title>... with flags unfurled...  Jul 2007</title>
<link>http://znouza.meinlschmidt.org/blog/</link>
<description>we reached the dizzy heights...</description>
<language>en</language>
<item>
    <title>Exception handling</title>
    <link>http://znouza.meinlschmidt.org/blog/programming/rails/070709-0115.html</link>
    <description>
./lib/mymodule.rb

&lt;pre class=&quot;prettyprint&quot;&gt;
module MyModule

  class Error &lt; RuntimeError; end
  class ConnectionError &lt; Error; end

  def connect
    
    if something_failed?
      raise ConnectionError, &quot;connection failed due to...&quot;
    end
  end
end
&lt;/pre&gt;

somewhere in controller

&lt;pre class=&quot;prettyprint&quot;&gt;
  include MyModule

  def do_connect
    begin
      connect
    rescue MyModule::ConnectionError =&gt; err
      flash.now[:notice] =&gt; err
    end
  end
&lt;/pre&gt;
</description>
  </item>
<item>
    <title>own application configuration</title>
    <link>http://znouza.meinlschmidt.org/blog/programming/rails/070709-0108.html</link>
    <description>
./config/my_configuration.yml

&lt;pre class=&quot;prettyprint&quot;&gt;
MyConfig:
 username: my_username
 password: my_password
 host: my_host
&lt;/pre&gt;

./config/environment.rb

&lt;pre class=&quot;prettyprint&quot;&gt;
require &apos;ostruct&apos;
require &apos;yaml&apos;

OwnConfigFile = &quot;#{RAILS_ROOT}/config/my_configuration.yml&quot;
if File.exist?(MyConfigFile)
  ::ApplicationConfig = OpenStruct.new(YAML.load_file(MyConfigFile))
end
&lt;/pre&gt;

in application:

&lt;pre class=&quot;prettyprint&quot;&gt;
config = ApplicationConfig.MyConfig;
puts config[&apos;username&apos;]
&lt;/pre&gt;
</description>
  </item>
   </channel>
</rss>