<?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>Simply Excited - Technology, Outdoor and Design &#187; Rails</title>
	<atom:link href="http://scoop.simplyexcited.co.uk/category/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://scoop.simplyexcited.co.uk</link>
	<description>Technology, Design and Outdoor</description>
	<lastBuildDate>Fri, 23 Dec 2011 11:33:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>I18n fix</title>
		<link>http://scoop.simplyexcited.co.uk/2011/03/23/i18n-fix/</link>
		<comments>http://scoop.simplyexcited.co.uk/2011/03/23/i18n-fix/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 13:51:58 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2011/03/23/i18n-fix/</guid>
		<description><![CDATA[	Fix for an error with I18n, ruby 1.9.2 and Rails 3.

	(incompatible character encodings: UTF-8 and ASCII-8BIT)

	
 ]]></description>
			<content:encoded><![CDATA[	<p>Fix for an error with I18n, ruby 1.9.2 and Rails 3.</p>

	<p>(incompatible character encodings: <span class="caps">UTF</span>-8 and <span class="caps">ASCII</span>-8BIT)</p>

	<p><script src="https://gist.github.com/883109.js?file=t_fix.rb"></script></p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2011/03/23/i18n-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3 Benchmarks Startup Time</title>
		<link>http://scoop.simplyexcited.co.uk/2011/03/14/rails-3-benchmarks-startup-time/</link>
		<comments>http://scoop.simplyexcited.co.uk/2011/03/14/rails-3-benchmarks-startup-time/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 14:04:38 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2011/03/14/rails-3-benchmarks-startup-time/</guid>
		<description><![CDATA[	
Waiting

	I have been having an annoying problem recently. One of the projects I am working on has a fairly large Gemfile and this is impacting startup time considerably on Ruby 1.9.2.

	Ruby Start-up Times is a good article detailing boot up times for different ruby versions with a relatively fresh app.

	Well, the development app I am [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://s3.amazonaws.com/excitedmedia/waiting.png" alt="" border="0" /><br />
<strong>Waiting</strong></p>

	<p>I have been having an annoying problem recently. One of the projects I am working on has a fairly large Gemfile and this is impacting startup time considerably on Ruby 1.9.2.</p>

	<p><a href="http://erik.debill.org/2011/02/19/ruby-start-up-times" title="">Ruby Start-up Times</a> is a good article detailing boot up times for different ruby versions with a relatively fresh app.</p>

	<p>Well, the development app I am currently working on has 148 gems defined in the Gemfile.lock. I don&#8217;t think this is overly excessive as many gems such as devise have many dependencies.</p>

	<p>The result is that it takes a long time to bootup rails when using 1.9.2. This means that repetitive tasks such as tests, generating migrations, running migrations, rake tasks, generators, basically anything which requires a boot of the rails environment takes a long time.</p>

	<p>This impacts the speedy development feel which rails gives you, diminishing the experience somewhat. I decided to try and see different boot times for different ruby versions.</p>

	<p>For the benchmarks I used the same script as used on the post <a href="http://erik.debill.org/2011/02/19/ruby-start-up-times" title="">Ruby Start-up Times</a></p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  <span style="color: #808080; font-style: italic;">#!/bin/bash</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> puts Time.now &gt; test_script
  <span style="color: #000000; font-weight: bold;">time</span> rails runner test_script
  <span style="color: #000000; font-weight: bold;">time</span> rails runner test_script
  <span style="color: #000000; font-weight: bold;">time</span> rails runner test_script</pre></div></div>
</p>




	<h2>Rails startup performance comparison</h2>

	<p><img src="http://s3.amazonaws.com/excitedmedia/rails-bootup.jpg" alt="" border="0" /></p>

	<p>The graph above shows the average run time for the above script in seconds for each of the ruby versions listed. The ruby versions were installed using rvm. The most recent <span class="caps">REE</span> gave a mysql2 segmentation fault so I went with the earlier version.</p>

	<h2>Results</h2>

	<p>Rubinius is painfully slow to startup, for me it is currently unusable. 1.9.2 is significantly slower than 1.8.7 for bootup. This is highly frustrating as once the application starts up, 1.9.2 feels snappier than 1.8.7.</p>

	<p><span class="caps">REE</span> takes the title for the fastest rails 3 bootup time in development for a project with a number of gems defined in the Gemfile.</p>

	<h2>Possible reasons for 1.9.2&#8217;s terrible performance</h2>

	<p>There is a thread about this on <a href="http://groups.google.com/group/rubyonrails-core/browse_thread/thread/88519ef5a53088a1/c01ba447c6dc0de7?lnk=raot" title="">Rails-Core</a></p>

	<p>To quote Yehuda Katz</p>

	<p><blockquote><br />
There are things that the C require code does in 1.9 that slow things down. One such example is re-checking $LOAD_PATH to make sure it is all expanded on every require. This is something that should be addressed by ruby-core. I&#8217;ll open a ticket on redmine if there isn&#8217;t one already.<br />
</blockquote></p>

	<p><blockquote><br />
I am also experiencing this problem and a $LOAD_PATH issue seems like a potential cause. Lets hope it gets fixed soon.<br />
</blockquote></p>

	<p>Digging deeper there is a <a href="http://redmine.ruby-lang.org/issues/show/3924" title="">bug report</a> on the ruby bugtracker but unfortunately it looks to be scheduled for the 1.9.3 release. It doesnt look like this is going to be coming out any time soon, so another solution needs to be found.</p>

	<h2>Suggestions for a quick fix</h2>

	<ul>
		<li>It is possible to stop bundler requiring all the gems on startup, and you then need to manually require them in your code. This is a potential solution but it would be a lot better if the bug in 1.9.2 could be fixed instead.</li>
	</ul>

	<ul>
		<li>Use <span class="caps">REE</span> for most of your development and use 1.9.2 in a separate terminal if you need it for tests etc.</li>
	</ul>

	<ul>
		<li>Some other kind of lazy loading solution would be excellent, or even better someone with knowledge of ruby internals who can fix this problem and it be released as a patch release rather than waiting for 1.9.3.</li>
	</ul>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2011/03/14/rails-3-benchmarks-startup-time/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Google Product Search Xml Generator</title>
		<link>http://scoop.simplyexcited.co.uk/2010/04/16/google-product-search-xml-generator/</link>
		<comments>http://scoop.simplyexcited.co.uk/2010/04/16/google-product-search-xml-generator/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 12:27:43 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2010/04/16/google-product-search-xml-generator/</guid>
		<description><![CDATA[	

	I have been working on a google base product search xml feed generator. It is in the form of a semi-customizable rake task. I have released this as a kind of rails plugin.

	rake googlebase:generate generates an xml file of your products.

	Configuration

	To configure, add Rails.root/config/google_base.yml

	Example google_base.yml file in files/google_base.yml


	As the structure of the xml is dependant [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://www.nerve.com/CS/blogs/scanner/2009/02/08-15/google.jpg" alt="" border="0" /></p>

	<p>I have been working on a google base product search xml feed generator. It is in the form of a semi-customizable rake task. I have released this as a kind of rails plugin.</p>

	<p>rake googlebase:generate generates an xml file of your products.</p>

	<h2>Configuration</h2>

	<p>To configure, add Rails.root/config/google_base.yml</p>

	<p>Example google_base.yml file in files/google_base.yml</p>


	<p>As the structure of the xml is dependant on your product models I have left it to the programmer to modify the google.rake file and set the correct instance methods for returning product information, along with the named_scope for returning live products.</p>

	<p><span class="caps">TODO</span>:</p>

	<p>Instead of editing this rake file manually it would be good to add a plugin type class method which can take the configuration of your products and generate this automatically.</p>

	<p>Its is <a href="http://github.com/pyrat/google-product-search" title="">available on github</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2010/04/16/google-product-search-xml-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jquery Assertion for Rails</title>
		<link>http://scoop.simplyexcited.co.uk/2010/04/10/jquery-assertion-for-rails/</link>
		<comments>http://scoop.simplyexcited.co.uk/2010/04/10/jquery-assertion-for-rails/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 13:24:24 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2010/04/10/jquery-assertion-for-rails/</guid>
		<description><![CDATA[	

	When doing functional testing of ajax actions it is nice to be able to test the format of the javascript returned to the browser.

	When using rjs I was using the excellent arts testing library, now I have moved to raw jquery instead. The method below provides a short hand way to test simple jquery methods. [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://miklb.com/user/files/jquery-logo.png" alt="" border="0" /></p>

	<p>When doing functional testing of ajax actions it is nice to be able to test the format of the javascript returned to the browser.</p>

	<p>When using rjs I was using the excellent arts testing library, now I have moved to raw jquery instead. The method below provides a short hand way to test simple jquery methods. it can be built upon for sure but this little regex is quite powerful.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">def</span> assert_jquery<span style="color:#006600; font-weight:bold;">&#40;</span>effect, id<span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_match<span style="color:#006600; font-weight:bold;">&#40;</span>/\$\<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'&quot;]+##{id}['</span><span style="color:#996600;">&quot;]+<span style="color:#000099;">\)</span>.#{effect}<span style="color:#000099;">\(</span>.*<span style="color:#000099;">\)</span>;/, @response.body)
  end</span></pre></div></div>
</p>



	<p>Consider the jquery</p>

<pre>
$("#announcement").hide();
</pre>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">  assert_jquery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'hide'</span>, <span style="color:#996600;">'announcement'</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>
</p>



	<p>This currently only works for id methods and when jquery isnt in compatibility mode. Also integration testing using something like <a href="http://github.com/jeresig/env-js" title="">env.js</a> and <a href="http://github.com/mynyml/harmony" title="">harmony</a> is a better way of javascript testing. Things like <a href="http://github.com/relevance/blue-ridge" title="">blue ridge</a> actually integrate the env.js framework into a rails plugin and are a great solution if you have to do some real heavy lifting.</p>

	<p>However, this method brings maximum results for minimum effort.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2010/04/10/jquery-assertion-for-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Mysql Gem on Snow Leopard and Macports</title>
		<link>http://scoop.simplyexcited.co.uk/2010/03/08/install-mysql-gem-on-snow-leopard-and-macports/</link>
		<comments>http://scoop.simplyexcited.co.uk/2010/03/08/install-mysql-gem-on-snow-leopard-and-macports/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 10:51:59 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2010/03/08/install-mysql-gem-on-snow-leopard-and-macports/</guid>
		<description><![CDATA[

	
export ARCHFLAGS=&#34;-arch i386 -arch x86_64&#34; ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config



 ]]></description>
			<content:encoded><![CDATA[

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">ARCHFLAGS=</span><span style="color: #ff0000;">&quot;-arch i386 -arch x86_64&quot;</span> ; gem <span style="color: #c20cb9; font-weight: bold;">install</span> --no-rdoc --no-ri mysql -- --with-mysql-<span style="color: #007800;">dir=</span>/opt/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/mysql5 --with-mysql-<span style="color: #007800;">config=</span>/opt/<span style="color: #7a0874; font-weight: bold;">local</span>/lib/mysql5/bin/mysql_config</pre></div></div>
</p>


 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2010/03/08/install-mysql-gem-on-snow-leopard-and-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.3 Upgrade Notes</title>
		<link>http://scoop.simplyexcited.co.uk/2010/02/27/rails-2-3-upgrade-notes/</link>
		<comments>http://scoop.simplyexcited.co.uk/2010/02/27/rails-2-3-upgrade-notes/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 08:21:19 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2010/02/27/rails-2-3-upgrade-notes/</guid>
		<description><![CDATA[	
In Need of Love and Care

	I have written a number of rails applications over the past few years. While new projects are using rails 2.3 I have a number of older applications which I should have upgraded before but havent. Anyway, here is some little notes to take into account when upgrading to rails 2.3. [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://farm2.static.flickr.com/1046/1413334961_ab39bbcf12.jpg" alt="" border="0" /><br />
<strong>In Need of Love and Care</strong></p>

	<p>I have written a number of rails applications over the past few years. While new projects are using rails 2.3 I have a number of older applications which I should have upgraded before but havent. Anyway, here is some little notes to take into account when upgrading to rails 2.3. Then from here you are placed well for the upcoming release of rails 3.</p>

	<ul>
		<li>to_param method issues (fixnum to string)</li>
		<li>test_helper modifications &#8211; class name (ActiveSupport::TestCase and all unit tests need to extend this)</li>
		<li>add include ActionController::TestProcess to test_helper.rb</li>
		<li>to silence spec warnings for old unpacked gems &#8211; Rails::VendorGemSourceIndex.silence_spec_warnings = true</li>
	</ul>

	<ul>
		<li>sessions</li>
	</ul>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>.<span style="color:#9900CC;">session</span> = <span style="color:#006600; font-weight:bold;">&#123;</span>
  <span style="color:#ff3333; font-weight:bold;">:key</span> =&gt; <span style="color:#996600;">'_session_name'</span>,
  <span style="color:#ff3333; font-weight:bold;">:secret</span> =&gt; <span style="color:#996600;">'d00cda5710eab8sdfsdf6c5fe165780074fa5027f50168a0bd0ae2832c05bb4f804a07228b220b67e'</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>
</p>



	<p>In an initializer instead of environment.rb (some plugins access the session in a different manner.)</p>

	<ul>
		<li>Truncate format is deprecated, update to include :length hash key.</li>
		<li>If you are defining constants in environment.rb, move them to an initializer to make them play better with tests.</li>
		<li>To access session_id you first have to call the session. Also, the method of accessing the session id has changed.</li>
	</ul>

	<p>The following 2 lines are required to get the session id.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">session<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:session_id</span><span style="color:#006600; font-weight:bold;">&#93;</span>
id = request.<span style="color:#9900CC;">session_options</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>
</p>



 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2010/02/27/rails-2-3-upgrade-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Christmas Card Labels Application</title>
		<link>http://scoop.simplyexcited.co.uk/2009/12/08/christmas-card-labels-application/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/12/08/christmas-card-labels-application/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 10:58:19 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2009/12/08/christmas-card-labels-application/</guid>
		<description><![CDATA[	

	I have been keen to get my hands dirty with ExtJS, so jumped at the chance to make a christmas card list application which can print the list to labels; to stick on envelopes.

	I have finally become mature enough to have a christmas card list along with my girlfriend, which is useful for keeping track [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://scoop.simplyexcited.co.uk/wp-content/uploads/2009/12/santa.jpg" alt="santa" border="0" /></p>

	<p>I have been keen to get my hands dirty with ExtJS, so jumped at the chance to make a christmas card list application which can print the list to labels; to stick on envelopes.</p>

	<p>I have finally become mature enough to have a christmas card list along with my girlfriend, which is useful for keeping track of friends both in Trondheim and the United Kingdom.</p>

	<p>To get it up and running on heroku it is pretty swift &#8211;<br />

<div class="wp_syntax"><div class="code"><pre class="bash">  git clone git://github.com/pyrat/christmas-card-labels.git
  <span style="color: #7a0874; font-weight: bold;">cd</span> christmas-card-labels
  <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> heroku
  heroku create
  git push heroku master
  heroku rake db:migrate</pre></div></div>
</p>



	<p>You are now good to go, you may need to tweak the css (labels.css) to match your specific labels which can be a painful experience.</p>

	<p>Default username / password is god / jul which is norwegian for merry christmas!</p>

	<p>There is a demo version <a href="http://jul.simplyexcited.co.uk" title="">online</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/12/08/christmas-card-labels-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configurable ActiveResource Site Variable</title>
		<link>http://scoop.simplyexcited.co.uk/2009/09/16/configurable-activeresource-site-variable/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/09/16/configurable-activeresource-site-variable/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 10:12:03 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.simplyexcited.co.uk/2009/09/16/configurable-activeresource-site-variable/</guid>
		<description><![CDATA[	

	flickr


	Documentation on ActiveResource is fairly thin on the ground.

	If you are using ActiveResource in the real world it is likely that you will want to use different webservices depending on what environment you are in. (Staging, Development, CI, Production etc.)

	Heres how to do it. This assumes the REST api has been put under the api [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://farm1.static.flickr.com/117/263092176_5be36eeed3_d.jpg" alt="" border="0" /></p>

	<p><a href="http://www.flickr.com/photos/psd/263092176/" title="">flickr</a></p>


	<p>Documentation on ActiveResource is fairly thin on the ground.</p>

	<p>If you are using ActiveResource in the real world it is likely that you will want to use different webservices depending on what environment you are in. (Staging, Development, CI, Production etc.)</p>

	<p>Heres how to do it. This assumes the <span class="caps">REST</span> api has been put under the api namespace and has been setup with <span class="caps">HTTP </span>Authentication.</p>

	<p><em>config/initializers/config.rb</em></p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">  raw_config = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span>RAILS_ROOT + <span style="color:#996600;">&quot;/config/config.yml&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  GLOBAL = <span style="color:#CC00FF; font-weight:bold;">YAML</span>.<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span>raw_config<span style="color:#006600; font-weight:bold;">&#41;</span>
  APP_CONFIG = GLOBAL<span style="color:#006600; font-weight:bold;">&#91;</span>Rails.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>
</p>



	<p><em>config/config.yml</em></p>

	<p>
<div class="wp_syntax"><div class="code"><pre>  development:
      webservice: http://username:password@localhost:3001/api/
  test:
      webservice: http://username:password@localhost:3001/api/
  staging:
      webservice: https://username:password@staging.com/api/
  production:
      webservice: https://username:password@production.com/api/</pre></div></div>
</p>




	<p><em>app/models/income</em>type.rb_</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">  <span style="color:#9966CC; font-weight:bold;">class</span> IncomeType &lt; <span style="color:#6666ff; font-weight:bold;">ActiveResource::Base</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">site</span> = APP_CONFIG<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'webservice'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>
</p>



	<p>Here is <a href="http://railscasts.com/episodes/95-more-on-activeresource" title="">a great railscast</a> on the subject.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/09/16/configurable-activeresource-site-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Submodule Gotcha</title>
		<link>http://scoop.simplyexcited.co.uk/2009/08/12/git-submodule-gotcha/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/08/12/git-submodule-gotcha/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:14:05 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/08/12/git-submodule-gotcha/</guid>
		<description><![CDATA[	The gotcha comes when I switch branches back and forth between the &#8220;master&#8221; (no submodules, but with checked in source) and &#8220;dev&#8221; (where my submodule work is). Here&#8217;s what happens:

	
git checkout master




	error: Untracked working tree file &#8216;vendor/plugins/acts_as_list/lib/active_record/acts/list.rb&#8217; would be overwritten by merge.

	Here&#8217;s a workaround&#8230;
To go back to a branch w/o submodules

	
rm -rf vendor/plugins
git checkout master
git [...]]]></description>
			<content:encoded><![CDATA[	<p>The gotcha comes when I switch branches back and forth between the &#8220;master&#8221; (no submodules, but with checked in source) and &#8220;dev&#8221; (where my submodule work is). Here&#8217;s what happens:</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">git checkout master</pre></div></div>
</p>



	<p>error: Untracked working tree file &#8216;vendor/plugins/acts_as_list/lib/active_record/acts/list.rb&#8217; would be overwritten by merge.</p>

	<p>Here&#8217;s a workaround&#8230;<br />
To go back to a branch w/o submodules</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">rm</span> -rf vendor/plugins
git checkout master
git checkout vendor/plugins</pre></div></div>
</p>



	<p>To go back to a branch w/ submodules</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">git checkout dev
git submodule update --init</pre></div></div>
</p>



	<p>Another gotcha, when I tried to merge dev into master I got &#8220;fatal: cannot read object&#8230; It is a submodule!&#8221; A solution is:</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">git merge -s  resolve</pre></div></div>
</p>



	<p><a href="http://www.ultrasaurus.com/sarahblog/2009/03/git-submodule-gotcha/comment-page-1/#comment-725" title="">Original Article</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/08/12/git-submodule-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using mod_expires to speed up serving pages with apache</title>
		<link>http://scoop.simplyexcited.co.uk/2009/05/21/using-mod_expires-to-speed-up-serving-pages-with-apache/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/05/21/using-mod_expires-to-speed-up-serving-pages-with-apache/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:43:24 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/05/21/using-mod_expires-to-speed-up-serving-pages-with-apache/</guid>
		<description><![CDATA[	This is rails specific to a certain extend and involves setting the expires header on static asset to make browsers cache. This can be dangerous so is best used with timestamped css and javascript assets.

	By default: rails helpers will add a timestamp onto the end of the asset so when you redeploy the file the [...]]]></description>
			<content:encoded><![CDATA[	<p>This is rails specific to a certain extend and involves setting the expires header on static asset to make browsers cache. This can be dangerous so is best used with timestamped css and javascript assets.</p>

	<p>By default: rails helpers will add a timestamp onto the end of the asset so when you redeploy the file the browsers will recache the file because the timestamp has changed.</p>

	<p>eg.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre>  &lt;script src=&quot;/javascripts/all.js?1242919746&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre></div></div>
</p>



	<p>To setup mod_expires apache on debian based:</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  <span style="color: #c20cb9; font-weight: bold;">sudo</span> a2enmod expires</pre></div></div>
</p>



	<p>Then in your config</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  ExpiresActive On
  &lt;FilesMatch <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(js|css)$&quot;</span>&gt;
    ExpiresDefault <span style="color: #ff0000;">&quot;access plus 1 year&quot;</span>
  &lt;/FilesMatch&gt;</pre></div></div>
</p>



	<p>You can easily add image types to this as well but often css loads images and designer often forget to use these helper methods. So in the real world just doing it with js and css makes it safer to do with maximum performance gain.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/05/21/using-mod_expires-to-speed-up-serving-pages-with-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing git from source ubuntu</title>
		<link>http://scoop.simplyexcited.co.uk/2009/05/14/installing-git-from-source-ubuntu/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/05/14/installing-git-from-source-ubuntu/#comments</comments>
		<pubDate>Thu, 14 May 2009 16:00:21 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/05/14/installing-git-from-source-ubuntu/</guid>
		<description><![CDATA[	When you have an old version of ubuntu but want a new version of git. And potentially have it already installed.

	
sudo apt-get update
sudo apt-get remove git-core
sudo apt-get install tcl8.4 tk8.4
sudo apt-get build-dep git-core
&#160;
wget http://kernel.org/pub/software/scm/git/git-1.6.3.1.tar.gz
tar -zxvf git-1.6.3.1.tar.gz
cd git-1.6.3.1
./configure
make
sudo make install
&#160;
&#160;
sudo ln -s /usr/local/bin/git /usr/bin/git



 ]]></description>
			<content:encoded><![CDATA[	<p>When you have an old version of ubuntu but want a new version of git. And potentially have it already installed.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get remove git-core
<span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> tcl8<span style="color: #000000;">.4</span> tk8<span style="color: #000000;">.4</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get build-dep git-core
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">wget</span> http://kernel.org/pub/software/scm/git/git<span style="color: #000000;">-1.6</span><span style="color: #000000;">.3</span><span style="color: #000000;">.1</span>.<span style="color: #c20cb9; font-weight: bold;">tar</span>.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> -zxvf git<span style="color: #000000;">-1.6</span><span style="color: #000000;">.3</span><span style="color: #000000;">.1</span>.<span style="color: #c20cb9; font-weight: bold;">tar</span>.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> git<span style="color: #000000;">-1.6</span><span style="color: #000000;">.3</span><span style="color: #000000;">.1</span>
./configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> -s /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/bin/git /usr/bin/git</pre></div></div>
</p>


 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/05/14/installing-git-from-source-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing ImageMagick / Rmagick on Ubuntu Hardy</title>
		<link>http://scoop.simplyexcited.co.uk/2009/05/14/installing-imagemagick-rmagick-on-ubuntu-hardy/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/05/14/installing-imagemagick-rmagick-on-ubuntu-hardy/#comments</comments>
		<pubDate>Thu, 14 May 2009 11:22:28 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/05/14/installing-imagemagick-rmagick-on-ubuntu-hardy/</guid>
		<description><![CDATA[	Mainly to help me remember in the future. Might be useful to you also..

	
  sudo apt-get update
  sudo apt-get install imagemagick
  sudo apt-get install libmagick9-dev
  sudo gem install rmagick



 ]]></description>
			<content:encoded><![CDATA[	<p>Mainly to help me remember in the future. Might be useful to you also..</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get update
  <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> imagemagick
  <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> libmagick9-dev
  <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rmagick</pre></div></div>
</p>


 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/05/14/installing-imagemagick-rmagick-on-ubuntu-hardy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Daily Photo &#8211; Scheduled Uploads to Flickr</title>
		<link>http://scoop.simplyexcited.co.uk/2009/05/09/introducing-daily-photo-scheduled-uploads-to-flickr/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/05/09/introducing-daily-photo-scheduled-uploads-to-flickr/#comments</comments>
		<pubDate>Sat, 09 May 2009 10:12:16 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/05/09/introducing-daily-photo-scheduled-uploads-to-flickr/</guid>
		<description><![CDATA[	
Daily Photo

	Introducing daily photo a wee web application which lets you upload photos to flickr on a daily basis. This allows you to make the most of RSS feeds and social applications that link to your flickr account.

	Daily photo will also be useful if you run a photo blog which is powered off flickr. The [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://farm4.static.flickr.com/3647/3515249342_5c51cc720c_o.gif" width="500" height="100" alt="Daily Photo Scheduled Flickr Uploads" /><br />
<a href="http://dailyphotoapp.com" title="">Daily Photo</a></p>

	<p>Introducing <strong>daily photo</strong> a wee web application which lets you upload photos to flickr on a daily basis. This allows you to make the most of <span class="caps">RSS</span> feeds and social applications that link to your flickr account.</p>

	<p>Daily photo will also be useful if you run a photo blog which is powered off flickr. The ability to decide when photos appear is functionality which flickr is sorely missing.</p>

	<p>Daily photo is a wee app, written in hours rather than days. Functionality is as minimal as possible while getting the job done. Steps to getting your flickr uploads scheduled are as follows:</p>

	<ul>
		<li>Go to <a href="http://dailyphotoapp.com" title="">daily photo</a></li>
		<li>Sign up for an account</li>
		<li>Check your email and confirm your email address</li>
		<li>You will be redirected to flickr where you confirm that daily photo can have access to your account for uploading of photos.</li>
		<li>Upload photos to daily photo with names, descriptions and tags. Define on what day you want the photo to be uploaded to flickr.</li>
		<li>Sit back watch your flickr account update automagically!</li>
	</ul>

	<p><a href="http://farm4.static.flickr.com/3608/3515266728_1ea2b615eb_o.jpg" target="_blank"><img src="http://farm4.static.flickr.com/3608/3515266728_cd08ba8e40.jpg" border="0"  alt="Front page"/></a><br />
<strong>Front page</strong></p>

	<p><a href="http://farm4.static.flickr.com/3551/3515287856_2a96ee202b_o.jpg" target="_blank"><img src="http://farm4.static.flickr.com/3551/3515287856_028cbd8468.jpg" border="0"  alt="Your Photos upload queue"/></a><br />
<strong>Your Photos upload queue</strong></p>

	<p>So if you have a need for <a href="http://dailyphotoapp.com" title="">daily photo</a>, your welcome! Fill your boots.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/05/09/introducing-daily-photo-scheduled-uploads-to-flickr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>libxml-ruby on ubuntu</title>
		<link>http://scoop.simplyexcited.co.uk/2009/05/07/libxml-ruby-on-ubuntu/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/05/07/libxml-ruby-on-ubuntu/#comments</comments>
		<pubDate>Thu, 07 May 2009 14:41:54 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/05/07/libxml-ruby-on-ubuntu/</guid>
		<description><![CDATA[

	
  sudo apt-get install libxml2 libxml2-dev
  sudo gem install libxml-ruby



 ]]></description>
			<content:encoded><![CDATA[

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  <span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> libxml2 libxml2-dev
  <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> libxml-ruby</pre></div></div>
</p>


 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/05/07/libxml-ruby-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Testing your subdomain based rails application</title>
		<link>http://scoop.simplyexcited.co.uk/2009/04/14/testing-your-subdomain-based-rails-application/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/04/14/testing-your-subdomain-based-rails-application/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 09:10:30 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/04/14/testing-your-subdomain-based-rails-application/</guid>
		<description><![CDATA[	
(Courtesy: flickr)

	I was looking for a way to set the request host when testing an application I am currently working on. It has &#8216;basecamp-style&#8217; subdomains; I wanted to test these.

	Insert the following snippet at the bottom of test_helper.rb to set the host to &#8216;test.local.host&#8217;

	
  # This is a hack on rails to allow testing [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://scoop.simplyexcited.co.uk/wp-content/uploads/2009/04/no-www.jpg" alt="no www" border="0" /><br />
(Courtesy: <a href="http://www.flickr.com/photos/silvery/649832246/" title="">flickr</a>)</p>

	<p>I was looking for a way to set the request host when testing an application I am currently working on. It has &#8216;basecamp-style&#8217; subdomains; I wanted to test these.</p>

	<p>Insert the following snippet at the bottom of test_helper.rb to set the host to &#8216;test.local.host&#8217;</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">  <span style="color:#008000; font-style:italic;"># This is a hack on rails to allow testing of subdomain based systems.</span>
  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'active_support/test_case'</span>
  <span style="color:#9966CC; font-weight:bold;">module</span> ActionController
    <span style="color:#9966CC; font-weight:bold;">class</span> TestCase &lt; <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
      <span style="color:#9966CC; font-weight:bold;">def</span> setup_controller_request_and_response
        <span style="color:#0066ff; font-weight:bold;">@controller</span> = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#9900CC;">controller_class</span>.<span style="color:#9900CC;">new</span>
        <span style="color:#0066ff; font-weight:bold;">@controller</span>.<span style="color:#9900CC;">request</span> = <span style="color:#0066ff; font-weight:bold;">@request</span> = TestRequest.<span style="color:#9900CC;">new</span>
        <span style="color:#0066ff; font-weight:bold;">@response</span> = TestResponse.<span style="color:#9900CC;">new</span>
        <span style="color:#0066ff; font-weight:bold;">@request</span>.<span style="color:#9900CC;">host</span> = <span style="color:#996600;">&quot;test.local.host&quot;</span>
        <span style="color:#0066ff; font-weight:bold;">@controller</span>.<span style="color:#9900CC;">params</span> = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
        <span style="color:#0066ff; font-weight:bold;">@controller</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:initialize_current_url</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>
</p>


 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/04/14/testing-your-subdomain-based-rails-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Going Live with Rails</title>
		<link>http://scoop.simplyexcited.co.uk/2009/03/27/going-live-with-rails/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/03/27/going-live-with-rails/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 17:29:59 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/03/27/going-live-with-rails/</guid>
		<description><![CDATA[	

	Once an application gets to the production stage, people get all excited. The project is coming to fruition. Is it all over? No, its just the beginning. Ideally, you want your application to run trouble-free while you sit back and relax.

	In this short article I will describe the steps that I go through when setting [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://farm4.static.flickr.com/3399/3182532353_4bac629c84.jpg" alt="" border="0" /></p>

	<p>Once an application gets to the production stage, people get all excited. The project is coming to fruition. Is it all over? No, its just the beginning. Ideally, you want your application to run trouble-free while you sit back and relax.</p>

	<p>In this short article I will describe the steps that I go through when setting up a production environment. If you are interested in this subject and want a better guide please refer to <a href="http://www.pragprog.com/titles/fr_deploy/deploying-rails-applications" title="">deploying rails applications</a></p>

	<h2>Monit</h2>

	<p>This will keep everything running, I use this rather than <a href="http://github.com/mojombo/god/tree/master" title="">god</a> as it seems more stable and less memory hungry. I have used god a bit; the name also puts me off.</p>

	<p>We still run <a href="http://www.ubuntu.com/" title="">ubuntu</a> not cool enough for <a href="http://www.centos.org/" title="">CentOS</a> yet so.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">aptitude <span style="color: #c20cb9; font-weight: bold;">install</span> monit</pre></div></div>
</p>



	<p>Example <a href="http://scoop.simplyexcited.co.uk/2008/11/18/example-ubuntu-hardy-slicehost-monit-config/" title="">monit config</a> for rails app server with passenger.</p>

	<h2>Logrotate</h2>

	<p>You dont want massive logs slowing your app down after its been running 6 months, remember to <a href="http://scoop.simplyexcited.co.uk/2007/09/29/logrotate-in-rails/" title="">configure</a> this as it is often overlooked.</p>

	<h2>Passenger</h2>

	<p>Passenger or mod_rails is in active development and is used by a lot of the big ruby on rails companies and on the big sites. Deployment of production level apps used to be about packs of mongrels and frontend lightweight webservers. No longer.</p>

	<h2>Capistrano-ext</h2>

	<p>Deployment with capistrano is standard within the community, with the capistrano-ext gem you can run multistage deployments.</p>

	<p>So</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">cap production deploy</pre></div></div>
</p>



	<p>Will deploy to production.</p>

	<p>A list of my capistrano bash aliases are as follows. I find them <strong>very</strong> useful.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cpd=</span><span style="color: #ff0000;">&quot;cap deploy&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cpdm=</span><span style="color: #ff0000;">&quot;cap deploy:migrations&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cpsd=</span><span style="color: #ff0000;">&quot;cap staging deploy&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cpsdm=</span><span style="color: #ff0000;">&quot;cap staging deploy:migrations&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cppd=</span><span style="color: #ff0000;">&quot;cap production deploy&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cppdm=</span><span style="color: #ff0000;">&quot;cap production deploy:migrations&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cptd=</span><span style="color: #ff0000;">&quot;cap testing deploy&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cptdm=</span><span style="color: #ff0000;">&quot;cap testing deploy:migrations&quot;</span></pre></div></div>
</p>



	<h2>Backups</h2>

	<p>You need to be covered if something goes wrong. You need to backup static assets and database. I will not go into this here. Ideally, backup to an offsite location. eg. Amazon S3.</p>

	<h2>Exception notification</h2>

	<p>Make sure you have the <a href="http://github.com/rails/exception_notification/tree/master" title="">exception notification</a> plugin on the go, so you get emails when things break.</p>

	<h2>New Relic</h2>

	<p>The <a href="http://www.newrelic.com/" title="">new relic</a> performance monitoring service is great for keeping an eye on things within your production application. And there is a free version!</p>

	<h2>Version Control</h2>

	<p>Create a production branch in your version control and deploy from that. Then as you work for bugfixes and new features on master you then merge with the production branch for deployment.</p>

	<p>eg.</p>

	<p>To merge master with production.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">git checkout production
git merge master</pre></div></div>
</p>



	<p>You can then also do critical changes to the production branch. And to get this back into master.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">git checkout master
git merge production</pre></div></div>
</p>



	<p>Thats all for now. Any comments?</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/03/27/going-live-with-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autotest Growl Notifications</title>
		<link>http://scoop.simplyexcited.co.uk/2009/03/23/autotest-growl-notifications/</link>
		<comments>http://scoop.simplyexcited.co.uk/2009/03/23/autotest-growl-notifications/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 17:45:34 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2009/03/23/autotest-growl-notifications/</guid>
		<description><![CDATA[	

	I recently have had to set this up on another machine so here is a little guide which might help you if you want to setup growl notification of autotest results.

	
		Make sure growl is installed
		Make sure growlnotify is installed you will find it in the Extras directory of the Growl dmg (copy growlnotify to /usr/local/bin [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://scoop.simplyexcited.co.uk/wp-content/uploads/2009/03/growlers.jpg" alt="growlers" border="0" /></p>

	<p>I recently have had to set this up on another machine so here is a little guide which might help you if you want to setup growl notification of autotest results.</p>

	<ul>
		<li>Make sure <a href="http://growl.info" title="">growl</a> is installed</li>
		<li>Make sure growlnotify is installed you will find it in the Extras directory of the Growl dmg (copy growlnotify to /usr/local/bin to test this open a terminal and type growlnotify)</li>
		<li>Add the following to a file called ~/.autotest</li>
	</ul>

	<p>
<div class="wp_syntax"><div class="code"><pre class="ruby">  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'autotest/redgreen'</span>
  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'autotest/timestamp'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">module</span> <span style="color:#6666ff; font-weight:bold;">Autotest::Growl</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">growl</span><span style="color:#006600; font-weight:bold;">&#40;</span>title, msg, img, pri=<span style="color:#006666;">0</span>, sticky=<span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}&quot;</span> 
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:ran_command</span> <span style="color:#9966CC; font-weight:bold;">do</span> |at|
      image_root = <span style="color:#996600;">&quot;~/.autotest_images&quot;</span> 
      results = <span style="color:#006600; font-weight:bold;">&#91;</span>at.<span style="color:#9900CC;">results</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">flatten</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      output = results.<span style="color:#9900CC;">slice</span><span style="color:#006600; font-weight:bold;">&#40;</span>/<span style="color:#006600; font-weight:bold;">&#40;</span>\d+<span style="color:#006600; font-weight:bold;">&#41;</span>\stests,\s<span style="color:#006600; font-weight:bold;">&#40;</span>\d+<span style="color:#006600; font-weight:bold;">&#41;</span>\sassertions,\s<span style="color:#006600; font-weight:bold;">&#40;</span>\d+<span style="color:#006600; font-weight:bold;">&#41;</span>\sfailures,\s<span style="color:#006600; font-weight:bold;">&#40;</span>\d+<span style="color:#006600; font-weight:bold;">&#41;</span>\serrors/<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> output
        <span style="color:#9966CC; font-weight:bold;">if</span> $~<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> &gt; <span style="color:#006666;">0</span> || $~<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> &gt; <span style="color:#006666;">0</span>
          growl <span style="color:#996600;">&quot;FAIL&quot;</span>, <span style="color:#996600;">&quot;#{output}&quot;</span>, <span style="color:#996600;">&quot;#{image_root}/fail.png&quot;</span>, <span style="color:#006666;">2</span>
        <span style="color:#9966CC; font-weight:bold;">else</span>
          growl <span style="color:#996600;">&quot;Pass&quot;</span>, <span style="color:#996600;">&quot;#{output}&quot;</span>, <span style="color:#996600;">&quot;#{image_root}/pass.png&quot;</span> 
        <span style="color:#9966CC; font-weight:bold;">end</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>
</p>



	<p>Extract <a href="http://s3.amazonaws.com/excitedmedia/autotest_images.tar.gz" title="">this file</a> to ~/.autotest_images directory.</p>

	<p>You are now good to go!</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2009/03/23/autotest-growl-notifications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploy when github goes down</title>
		<link>http://scoop.simplyexcited.co.uk/2008/11/27/deploy-when-github-goes-down/</link>
		<comments>http://scoop.simplyexcited.co.uk/2008/11/27/deploy-when-github-goes-down/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 21:16:33 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2008/11/27/deploy-when-github-goes-down/</guid>
		<description><![CDATA[	
You are not screwed

	As git is distributed, the repository on your local machine is good enough to deploy from.

	First start a git server on your local machine.

	
  git daemon --base-path=/projects/rails_apps/ --export-all




	Then change your capistrano recipe to deploy with the copy command and change the repo to point to your local machine.

	
  set :deploy_via, [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://www.smarts.co.uk/Ireland/images/stories/services/crisis_management.jpg" alt="" border="0" /><br />
<em>You are not screwed</em></p>

	<p>As git is distributed, the repository on your local machine is good enough to deploy from.</p>

	<p>First start a git server on your local machine.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  git daemon --base-<span style="color: #007800;">path=</span>/projects/rails_apps/ --export-all</pre></div></div>
</p>



	<p>Then change your capistrano recipe to deploy with the copy command and change the repo to point to your local machine.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">  <span style="color: #000000; font-weight: bold;">set</span> :deploy_via, :copy
  <span style="color: #000000; font-weight: bold;">set</span> :repository <span style="color: #ff0000;">'git://127.0.0.1/proj_name'</span></pre></div></div>
</p>



	<p>Where in this example the code resides at */projects/rails_apps/proj_name*</p>

	<p>Now capistrano will deploy from your local repository, thus avoiding the currently melted <a href="http://github.com" title="">github</a></p>

	<p>There are other options which have been listed by chris wanstrath in the <a href="http://ozmm.org/posts/when_github_goes_down.html" title="">following article</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2008/11/27/deploy-when-github-goes-down/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Example ubuntu hardy slicehost monit config</title>
		<link>http://scoop.simplyexcited.co.uk/2008/11/18/example-ubuntu-hardy-slicehost-monit-config/</link>
		<comments>http://scoop.simplyexcited.co.uk/2008/11/18/example-ubuntu-hardy-slicehost-monit-config/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 14:28:36 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2008/11/18/example-ubuntu-hardy-slicehost-monit-config/</guid>
		<description><![CDATA[	

	I am using mod_rails aka passenger more and more in production server setups. This pastie shows a common setup for a standard ubuntu slice. You can almost cut n paste this config.

	Web interface for monit is disabled.
 ]]></description>
			<content:encoded><![CDATA[	<p><img src="http://scoop.simplyexcited.co.uk/wp-content/uploads/2008/11/pastie-day.jpg" alt="pastie day" border="0" /></p>

	<p>I am using mod_rails aka passenger more and more in production server setups. This <a href="http://pastie.org/317794" title="">pastie</a> shows a common setup for a standard ubuntu slice. You can almost cut n paste this config.</p>

	<p>Web interface for monit is disabled.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2008/11/18/example-ubuntu-hardy-slicehost-monit-config/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wee_lightbox rails plugin</title>
		<link>http://scoop.simplyexcited.co.uk/2008/08/06/wee_lightbox-rails-plugin/</link>
		<comments>http://scoop.simplyexcited.co.uk/2008/08/06/wee_lightbox-rails-plugin/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 21:46:24 +0000</pubDate>
		<dc:creator>pyrat</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://scoop.cheerfactory.co.uk/2008/08/06/wee_lightbox-rails-plugin/</guid>
		<description><![CDATA[	

	Overview

	This is a packaged version of lightbox for viewing images on the screen in the popular lightbox design pattern. The plugin includes some view helpers and an automatic install script to make life easier.

	Please refer to the lightbox docs for more info. Included are some rails helpers for easy integration into your site. The lightbox [...]]]></description>
			<content:encoded><![CDATA[	<p><img src="http://farm3.static.flickr.com/2361/2738991929_fd280a5514_o.jpg" alt="" border="0" /></p>

	<h2>Overview</h2>

	<p>This is a packaged version of lightbox for viewing images on the screen in the popular lightbox design pattern. The plugin includes some view helpers and an automatic install script to make life easier.</p>

	<p>Please refer to the lightbox docs for more info. Included are some rails helpers for easy integration into your site. The lightbox javascript is slightly tweaked to configure the location of images and increase the speed of resize.</p>

	<p>You can edit lightbox.js to further tweak these if you wish.</p>

	<h2>Install</h2>


	<p>If you install from github with rails 2.1+ it will install the files into your public directory. If you install with another method, you may need to issue a recursive copy command manually.</p>

	<p>Also this install script is untested on windows.</p>

	<h2>Usage Example</h2>

	<p>In your layout add the following in the head section.</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">&lt;%= javascript_include_tag :defaults %&gt; 
&lt;%= yield :page_includes %&gt;</pre></div></div>
</p>



	<p>In your template:</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">&lt;%= load_lightbox %&gt;</pre></div></div>
</p>



	<p>For each image that you would like to make a lightbox to</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">&lt;%= lightbox_to<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'/images/small.gif'</span>, <span style="color: #ff0000;">'/images/large.gif'</span>, <span style="color: #ff0000;">&quot;Tasty image caption&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>
</p>



	<p>If you want to have more than one lightbox on a page and have the lightbox operate with a slideshow between images..</p>

	<p>
<div class="wp_syntax"><div class="code"><pre class="bash">&lt;%= lightbox_to<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'/images/small.gif'</span>, <span style="color: #ff0000;">'/images/large.gif'</span>, <span style="color: #ff0000;">&quot;Tasty image caption&quot;</span>, <span style="color: #ff0000;">&quot;group_name&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>
</p>



	<p>Where group name needs to be the same for all images in the slideshow.</p>

	<p><a href="http://github.com/pyrat/wee_lightbox/tree/master" title="">Github project page</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://scoop.simplyexcited.co.uk/2008/08/06/wee_lightbox-rails-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

