<?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>La rolls des blogs &#187; gem</title>
	<atom:link href="http://my.rails-royce.org/category/ruby/gem/feed/" rel="self" type="application/rss+xml" />
	<link>http://my.rails-royce.org</link>
	<description>Another Ruby and Rails blog</description>
	<lastBuildDate>Fri, 13 Jan 2012 23:47:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Reloading models in Rails 3.1 when usign Spork and cache_classes = true</title>
		<link>http://my.rails-royce.org/2012/01/14/reloading-models-in-rails-3-1-when-usign-spork-and-cache_classes-true/</link>
		<comments>http://my.rails-royce.org/2012/01/14/reloading-models-in-rails-3-1-when-usign-spork-and-cache_classes-true/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 23:47:52 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[gem]]></category>
		<category><![CDATA[metaprogramming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[cache_classes]]></category>
		<category><![CDATA[initializers]]></category>
		<category><![CDATA[spork]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=277</guid>
		<description><![CDATA[Speeding up you tests with Spork is very common when developping Rails applications. What Spork do is preloading your application in a server and copies a fork of that server whenever you run tests. It avoids reloading all the rails stack !! That is great !!! But the problem I ran into is that I &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2012/01/14/reloading-models-in-rails-3-1-when-usign-spork-and-cache_classes-true/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Speeding up you tests with <a href="https://github.com/sporkrb/spork">Spork</a> is very common when developping Rails applications.</p>
<p>What Spork do is preloading your application in a server and copies a fork of that server whenever you run tests.<br />
<strong><br />
It avoids reloading all the rails stack !! That is great !!!<br />
</strong><br />
But the problem I ran into is that I wanted to be able to</p>
<ul>
<li><strong>reload</strong> my application files</li>
<li>and keep <strong>cache_classes = true</strong></li>
</ul>
<p>That is why I like ruby and rails (and great coders there ! ). What I simply did :</p>
<ol>
<li>Reading and understanding the rails initialize process  (especially these lines <a href="https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb#L433-442">engine.rb</a> and <a href="https://github.com/rails/rails/blob/master/railties/lib/rails/application/finisher.rb#L51-56">finisher.rb</a> )</li>
<li>Adding these small pieces of code in my prefork block with <a href="https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujutsu">Spork trap method </a></li>
<li>trap eager loading in my prefork block like below</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rails/application'</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Use of https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujutsu</span>
  Spork.<span style="color:#9900CC;">trap_method</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rails::Application</span>, <span style="color:#ff3333; font-weight:bold;">:reload_routes</span>!<span style="color:#006600; font-weight:bold;">&#41;</span>
  Spork.<span style="color:#9900CC;">trap_method</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rails::Application::RoutesReloader</span>, <span style="color:#ff3333; font-weight:bold;">:reload</span>!<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rails/mongoid'</span>
  Spork.<span style="color:#9900CC;">trap_class_method</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rails::Mongoid</span>, <span style="color:#ff3333; font-weight:bold;">:load_models</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Prevent main application to eager_load in the prefork block (do not load files in autoload_paths)</span>
  Spork.<span style="color:#9900CC;">trap_method</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rails::Application</span>, <span style="color:#ff3333; font-weight:bold;">:eager_load</span>!<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Below this line it is too late...</span>
  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;../../config/environment&quot;</span>, <span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;"># Load all railties files</span>
  Rails.<span style="color:#9900CC;">application</span>.<span style="color:#9900CC;">railties</span>.<span style="color:#9900CC;">all</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>r<span style="color:#006600; font-weight:bold;">|</span> r.<span style="color:#9900CC;">eager_load</span>! <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>My own benefits : specs runs faster than setting cache_classes = false</p>
<p><strong>You need small explanation of what I&#8217;ve done !</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  Spork.<span style="color:#9900CC;">trap_method</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rails::Application</span>, <span style="color:#ff3333; font-weight:bold;">:eager_load</span>!<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;../../config/environment&quot;</span>, <span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  Rails.<span style="color:#9900CC;">application</span>.<span style="color:#9900CC;">railties</span>.<span style="color:#9900CC;">all</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>r<span style="color:#006600; font-weight:bold;">|</span> r.<span style="color:#9900CC;">eager_load</span>! <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>First, we prevent Rails::Application to loads files in the application autoload_paths such as app/models, app/controllers etc &#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  Spork.<span style="color:#9900CC;">trap_method</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Rails::Application</span>, <span style="color:#ff3333; font-weight:bold;">:eager_load</span>!<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Second, we load the rails stack :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;../../config/environment&quot;</span>, <span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Last, we eager load all the engines :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  Rails.<span style="color:#9900CC;">application</span>.<span style="color:#9900CC;">railties</span>.<span style="color:#9900CC;">all</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>r<span style="color:#006600; font-weight:bold;">|</span> r.<span style="color:#9900CC;">eager_load</span>! <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>Doing that we can make change in our models and avoid restarting spork.</p>
<p>Why don&#8217;t I just set cache_classes to false ?</p>
<p>Because the ActiveSupport::Dependencies.mechanism is set to :require and not :load</p>
<p>All application files are required and not just loaded (spork required them just after forking, not before).<br />
This trick could resolve some inconsistencies in your application (such as already defined constant and else &#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2012/01/14/reloading-models-in-rails-3-1-when-usign-spork-and-cache_classes-true/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rubygems mini mirror</title>
		<link>http://my.rails-royce.org/2011/09/27/rubygems-mini-mirror/</link>
		<comments>http://my.rails-royce.org/2011/09/27/rubygems-mini-mirror/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 08:33:45 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[bundler]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=272</guid>
		<description><![CDATA[Hey all, I just have published a new gem called rubygems-mini_mirror. This is a small stuff that needs improvement on speed speaking but it works. I will explain later on how it works because I have no time for that now.]]></description>
			<content:encoded><![CDATA[<p>Hey all,</p>
<p>I just have published a new gem called <a href="https://github.com/hallelujah/rubygems-mini_mirror" title="rubygems mini mirror">rubygems-mini_mirror</a>.</p>
<p>This is a small stuff that needs improvement on speed speaking but it works.<br />
I will explain later on how it works because I have no time for that now.</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2011/09/27/rubygems-mini-mirror/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rspec 2.x and Fixtures</title>
		<link>http://my.rails-royce.org/2011/03/17/rspec-2-and-fixtures/</link>
		<comments>http://my.rails-royce.org/2011/03/17/rspec-2-and-fixtures/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 11:48:40 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[activerecord]]></category>
		<category><![CDATA[active_record]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[metaprogramming]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[test-unit]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[méta-programmation]]></category>
		<category><![CDATA[metaprograming]]></category>
		<category><![CDATA[métaprogrammation]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=262</guid>
		<description><![CDATA[Hello, It&#8217;s been a while when I last updated this blog. It seems that Rspec 2 can not use fixtures from Activerecord 2.3.x ! Impossible ? Not really, and thanks to ruby it was possible for me. Let&#8217;s describe the background : First of all, I had a gem built on jeweler that uses ActiveSupport::TestCase &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2011/03/17/rspec-2-and-fixtures/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Hello, </p>
<p>It&#8217;s been a while when I last updated this blog. It seems that Rspec 2 can not use fixtures from Activerecord 2.3.x !</p>
<p>Impossible ? Not really, and thanks to ruby it was possible for me.</p>
<p>Let&#8217;s describe the background :</p>
<p>First of all, I had a gem built on jeweler that uses ActiveSupport::TestCase and ActiveRecord::Fixtures exactly implemented like in Rails<br />
But one day, I decided to switch to RSpec  (jeweler (1.5.2) uses as of my writing rspec ~> 2.3.0) </p>
<p>The conversion of test_* to &#8220;it&#8221; syntax was very quick and easy but loading fixtures was not !!!<br />
So here is my implementation if you want to know how can this be possible :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># spec/spec_helper.rb</span>
<span style="color:#008000; font-style:italic;"># .... some stuff ...</span>
 <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'activerecord'</span>
<span style="color:#9966CC; font-weight:bold;">module</span>  MyExtensions
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">extended</span><span style="color:#006600; font-weight:bold;">&#40;</span>base<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> base <span style="color:#008000; font-style:italic;"># Beginning of Proxy</span>
      <span style="color:#9966CC; font-weight:bold;">def</span> subclass_with_fixtures<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args,<span style="color:#006600; font-weight:bold;">&amp;</span>block<span style="color:#006600; font-weight:bold;">&#41;</span>
        child = subclass_without_fixtures<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args,<span style="color:#006600; font-weight:bold;">&amp;</span>block<span style="color:#006600; font-weight:bold;">&#41;</span>
        child.<span style="color:#9900CC;">module_eval</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActiveSupport::Callbacks</span>
          define_callbacks <span style="color:#ff3333; font-weight:bold;">:setup</span>, <span style="color:#ff3333; font-weight:bold;">:teardown</span>
          <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::TestFixtures</span>
&nbsp;
          <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">fixture_path</span> = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;../db/fixtures&quot;</span>,<span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">use_instantiated_fixtures</span> = <span style="color:#0000FF; font-weight:bold;">false</span>
          <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">use_transactional_fixtures</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
          <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">set_fixture_class</span> <span style="color:#ff3333; font-weight:bold;">:categories</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Categorie'</span>
&nbsp;
          <span style="color:#9966CC; font-weight:bold;">def</span> run_in_transaction?
            <span style="color:#0000FF; font-weight:bold;">true</span>
          <span style="color:#9966CC; font-weight:bold;">end</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
        child
      <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#008000; font-style:italic;"># End of method chain subclass_with_fixtures</span>
      alias_method_chain <span style="color:#ff3333; font-weight:bold;">:subclass</span>, <span style="color:#ff3333; font-weight:bold;">:fixtures</span>
    <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#008000; font-style:italic;"># End of Proxy</span>
  <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#008000; font-style:italic;"># End of extended</span>
<span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#008000; font-style:italic;"># End of MyExtensions</span>
&nbsp;
<span style="color:#6666ff; font-weight:bold;">RSpec::Core::ExampleGroup</span>.<span style="color:#9900CC;">extend</span><span style="color:#006600; font-weight:bold;">&#40;</span>MyExtensions<span style="color:#006600; font-weight:bold;">&#41;</span>
RSpec.<span style="color:#9900CC;">configure</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>config<span style="color:#006600; font-weight:bold;">|</span>
&nbsp;
  config.<span style="color:#9900CC;">after</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    run_callbacks <span style="color:#ff3333; font-weight:bold;">:teardown</span>, <span style="color:#ff3333; font-weight:bold;">:enumerator</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:reverse_each</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  config.<span style="color:#9900CC;">before</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    run_callbacks <span style="color:#ff3333; font-weight:bold;">:setup</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In my fixtures :</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">  # spec/db/fixtures/posts.yml
  a_post:
    title: &quot;My first post&quot;</pre></div></div>

<p>Now  when I want to load fixtures :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># spec/post_spec.rb</span>
describe <span style="color:#996600;">&quot;Post&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
   <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#9900CC;">fixtures</span> <span style="color:#ff3333; font-weight:bold;">:posts</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;should not save without a title&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
     post = posts<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:a_post</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    post.<span style="color:#9900CC;">title</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
    post.<span style="color:#9900CC;">save</span>.<span style="color:#9900CC;">should_not</span> be_true
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Maybe, a better way can be found &#8230; if so please inform me !!!</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2011/03/17/rspec-2-and-fixtures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTPClient and SSL verify certificate</title>
		<link>http://my.rails-royce.org/2011/01/12/httpclient-and-ssl-verify-certificate/</link>
		<comments>http://my.rails-royce.org/2011/01/12/httpclient-and-ssl-verify-certificate/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 11:58:51 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[gem]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[best practice]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[httpclient]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=255</guid>
		<description><![CDATA[If you as us in my company use self signed certificate and ran into an OpenSSL::SSL::SSLError when using httpclient gem. Here is how to bypass ssl certificate verification : The issue : require 'rubygems' require 'httpclient' &#160; client = HTTPClient.new url = &#34;https://www.server1.com&#34; client.get&#40;url&#41; at depth 1 - 19: self signed certificate in certificate chain &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2011/01/12/httpclient-and-ssl-verify-certificate/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>If you as us in my company use self signed certificate and ran into an OpenSSL::SSL::SSLError when using httpclient gem.</p>
<p>Here is how to bypass ssl certificate verification : </p>
<p>The issue :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'httpclient'</span>
&nbsp;
client = HTTPClient.<span style="color:#9900CC;">new</span>
url = <span style="color:#996600;">&quot;https://www.server1.com&quot;</span>
client.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>url<span style="color:#006600; font-weight:bold;">&#41;</span>
at depth <span style="color:#006666;">1</span> <span style="color:#006600; font-weight:bold;">-</span> <span style="color:#006666;">19</span>: <span style="color:#0000FF; font-weight:bold;">self</span> signed certificate <span style="color:#9966CC; font-weight:bold;">in</span> certificate chain
<span style="color:#6666ff; font-weight:bold;">OpenSSL::SSL::SSLError</span>: SSL_connect returned=<span style="color:#006666;">1</span> errno=<span style="color:#006666;">0</span> state=SSLv3 read server certificate B: certificate verify failed
	from <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>hery<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">gem</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1.8</span><span style="color:#006600; font-weight:bold;">/</span>gems<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">-</span>2.1.5.2<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">/</span>session.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">247</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`connect'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient/session.rb:247:in `</span>ssl_connect<span style="color:#996600;">'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient/session.rb:639:in `connect'</span>
	from <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>hery<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">gem</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1.8</span><span style="color:#006600; font-weight:bold;">/</span>gems<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">-</span>2.1.5.2<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">/</span>timeout.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">128</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`timeout'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient/session.rb:631:in `</span>connect<span style="color:#996600;">'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient/session.rb:522:in `query'</span>
	from <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>hery<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">gem</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1.8</span><span style="color:#006600; font-weight:bold;">/</span>gems<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">-</span>2.1.5.2<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">/</span>session.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">147</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`query'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient.rb:953:in `</span>do_get_block<span style="color:#996600;">'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient.rb:765:in `do_request'</span>
	from <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>hery<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">gem</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1.8</span><span style="color:#006600; font-weight:bold;">/</span>gems<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">-</span>2.1.5.2<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>httpclient.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">848</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`protect_keep_alive_disconnected'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient.rb:764:in `</span>do_request<span style="color:#996600;">'
	from /home/hery/.gem/ruby/1.8/gems/httpclient-2.1.5.2/lib/httpclient.rb:666:in `request'</span>
	from <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>hery<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">gem</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">1.8</span><span style="color:#006600; font-weight:bold;">/</span>gems<span style="color:#006600; font-weight:bold;">/</span>httpclient<span style="color:#006600; font-weight:bold;">-</span>2.1.5.2<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>httpclient.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">591</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`get'
	from (irb):5</span></pre></div></div>

<p>Solution :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">client.<span style="color:#9900CC;">ssl_config</span>.<span style="color:#9900CC;">verify_mode</span> = <span style="color:#6666ff; font-weight:bold;">OpenSSL::SSL::VERIFY_NONE</span>
client.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>url<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2011/01/12/httpclient-and-ssl-verify-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to translate your column fields and values with gettext in ruby on rails</title>
		<link>http://my.rails-royce.org/2010/07/07/how-to-translate-your-column-fields-and-values-with-gettext-in-ruby-on-rails/</link>
		<comments>http://my.rails-royce.org/2010/07/07/how-to-translate-your-column-fields-and-values-with-gettext-in-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 10:55:25 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[activerecord]]></category>
		<category><![CDATA[active_record]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[gettext]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[internationalisation]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[L10n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=160</guid>
		<description><![CDATA[I am proud to have published my first useful ruby gem. It is called gettext_column_mapping, you can check out the code in my github repository. I already released it as a gem through gemcutter/rubygems It is based upon Masao Mutoh (gettext and gettext_active_record) and Michael Grosser (fast_gettext and gettext_i18n_rails) works. Thanks to them History In &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2010/07/07/how-to-translate-your-column-fields-and-values-with-gettext-in-ruby-on-rails/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I am proud to have published my first useful ruby gem.<br />
It is called gettext_column_mapping, you can check out the code in <a href="http://github.com/hallelujah/gettext_column_mapping">my github repository</a>.<br />
I already released it  as a gem through <a href="http://rubygems.org/gems/gettext_column_mapping">gemcutter/rubygems</a> </p>
<p>It is based upon Masao Mutoh (<a href="http://github.com/mutoh/gettext">gettext</a> and <a href="http://github.com/mutoh/gettext_activerecord">gettext_active_record</a>) and Michael Grosser (<a href="http://github.com/grosser/fast_gettext">fast_gettext</a>  and <a href="http://github.com/grosser/gettext_i18n_rails">gettext_i18n_rails</a>) works.</p>
<p>Thanks to them <img src='http://my.rails-royce.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>History</strong></p>
<p>In my company we need a mean to translate bad written fields/table name in our database. Why ? because our applications are internationalized and we need to have cleaner name than &#8220;libelle&#8221; (the french word standing for label) to send to translators.</p>
<p>We also have some &#8220;constants&#8221; name saved in our tables so we need to translate them.</p>
<p>Then started this library a year ago.</p>
<p>Formerly, it was a library that depends on Rails &#8230; But I decided that it ccould be nice if it reaches these requirements :</p>
<ul>
<li> Use of Rubygem to spread it more easily</li>
<li> Must be Rails agnostic</li>
<li> Can use either mutoh&#8217;s gettext or grosser/fast_gettext</li>
<li> Can be implemented easily on rails 2.3.x and 3.0 or other ruby web framework</li>
<li> Can have some built-in configurable rake tasks</li>
</ul>
<p>All is done! </p>
<p>But now I would like to improve this gems  (API, tests, documentation, implementation) , so if someone who reads this post can help &#8230; I must remind you that this project is open source. Partly, it has been developped at work but I burnt most many hours of my sparetime than at work</p>
<p><strong>TODO ?</strong></p>
<ul>
<li>other database implementation (only mysql for now)</li>
<li>ORM agnosticism ? </li>
<li>More testing</li>
<li>More documentation</li>
<li>Rails < 2.3 compatibility backward</li>
<li>&#8230; and so many</li>
</ul>
<p>Try it and give me feedback</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2010/07/07/how-to-translate-your-column-fields-and-values-with-gettext-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bundler default Gemfile and custom Gemfile, example of wirble</title>
		<link>http://my.rails-royce.org/2010/06/29/bundler-default-gemfile-and-custom-gemfile-example-of-wirble/</link>
		<comments>http://my.rails-royce.org/2010/06/29/bundler-default-gemfile-and-custom-gemfile-example-of-wirble/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 13:38:34 +0000</pubDate>
		<dc:creator>Hallelujah</dc:creator>
				<category><![CDATA[bundler]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[gemfile]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[wirble]]></category>

		<guid isPermaLink="false">http://my.rails-royce.org/?p=152</guid>
		<description><![CDATA[Hi all, A simple trick I want to share with you if you are using Bundler (or rails 3) It matters if you want to install wirble gem in your workstation but not in your server Sometimes, you want to include some gem that are not mandatory for your application to run but you want &#8230; </p><p><a class="more-link block-button" href="http://my.rails-royce.org/2010/06/29/bundler-default-gemfile-and-custom-gemfile-example-of-wirble/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Hi all,<br />
A simple trick I want to share with you if you are using Bundler (or rails 3)<br />
It matters if you want to install wirble gem in your workstation but not in your server</p>
<p>Sometimes, you want to include some gem that are not mandatory for your application to run but you want to use in your workstation. E.g wirble, awesome_print etc &#8230; or other debugging tools</p>
<p>Just write something like this in your Gemfile</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># Gemfile</span>
<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">exist</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>file = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'../myGemfile'</span>,<span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  instance_eval<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span>file<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now in your myGemfile</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># myGemfile</span>
gem <span style="color:#996600;">'wirble'</span>
gem <span style="color:#996600;">'awesome_print'</span></pre></div></div>

<p>That&#8217;s all! You can now require &#8216;wirble&#8217; or &#8216;awesome_print&#8217; in your rails console</p>
]]></content:encoded>
			<wfw:commentRss>http://my.rails-royce.org/2010/06/29/bundler-default-gemfile-and-custom-gemfile-example-of-wirble/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

