<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.9.2" -->
<rss version="0.92">
<channel>
	<title>42</title>
	<link>http://www.42.mach7x.com</link>
	<description>Thoughts and tips about programming with Ruby on Rails</description>
	<lastBuildDate>Wed, 24 Feb 2010 09:34:39 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>replacing comma with and in a list with ruby</title>
		<description><![CDATA[Problem
You have a list, usually after using join(&#8220;,&#8221;) in an array that consists of different values ie &#8220;one, two, three, four&#8221;, but you want to replace the last comma with and so it would be &#8220;one, two, three and four&#8221;.
Solution
Use reverse initially to reverse the string, then use sub to replace the last comma with [...]]]></description>
		<link>http://www.42.mach7x.com/2010/02/23/replacing-comma-with-and-in-a-list-with-ruby/</link>
			</item>
	<item>
		<title>NoMethodError: Attempt to call private method in using Geokit rake task</title>
		<description><![CDATA[Problem
Trying to use the rake task for populating latitude and longitude details for addresses as described in the Web mashup projects book, gives the error about attempting to call private method.
Solution
Use the method save instead of update as suggested in the book.
]]></description>
		<link>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/</link>
			</item>
	<item>
		<title>NoMethodError: undefined method `timeout=&#8217; for Geokit::Geocoders:Module</title>
		<description><![CDATA[Problem
Using the latest version of Geokit gives the error for undefined method &#8216;timeout&#8217;. This could happen if the gem/plugin didn&#8217;t modify the config/environment.rb file, and you had to copy the configuration values from an older version.
Solution
The configuration variable has changed in the latest version (1.5.0) from timeout to request_timeout, so change it in your config/environment.rb [...]]]></description>
		<link>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/</link>
			</item>
	<item>
		<title>Using Flexigrid with MySQL field carriage returns</title>
		<description><![CDATA[Problem
You want to use flexigrid with a MySQL fields that contains carriage returns. As the flexigrid uses json it doesn&#8217;t work with carriage returns, and displays an empty page, instead of an error page.
Solution
In the page_name.json.erb file in the fields that has carriage returns  make sure that you use to_json method as in the [...]]]></description>
		<link>http://www.42.mach7x.com/2010/01/05/using-flexigrid-with-mysql-field-carriage-returns/</link>
			</item>
	<item>
		<title>You&#8217;re in the middle of a conflicted merge (git)</title>
		<description><![CDATA[Problem
Trying to update (pull) in git causes the error &#8216;you&#8217;re in the middle of a conflicted merge&#8217;.
Solution
To be able to get out of this error try the followng:

git reset &#8211;hard HEAD
git fetch origin
git reset &#8211;hard origin

to reset the state, and then you should be able to use git pull as normal.
]]></description>
		<link>http://www.42.mach7x.com/2009/11/24/youre-in-the-middle-of-a-conflicted-merge-git/</link>
			</item>
	<item>
		<title>ferret installation error</title>
		<description><![CDATA[Problem
Trying to install ferret with sudo gem install ferret fails with the following error:

fs_store.c:300: error: format not a string literal and no format arguments
make: *** [fs_store.o] Error 1
rake aborted!
Command failed with status (2): [make...]
Solution
As the installation was not possible by using the gem install command, the next step was to download the ferret.tar.gz file extract [...]]]></description>
		<link>http://www.42.mach7x.com/2009/11/03/ferret-installation-error/</link>
			</item>
	<item>
		<title>Pdf with .doc templates using prawn in Ruby on Rails</title>
		<description><![CDATA[Problem
You want to generate pdf documents in your Ruby on Rails app using .doc templates.
Solution
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).
Open the saved .odt document and export to pdf, making sure you use &#8216;Losless compression&#8217; in the General Options section.
Use imagemagick&#8217;s convert to make the pdf file [...]]]></description>
		<link>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/</link>
			</item>
	<item>
		<title>Freezing gems (other than rails) on 2.3.4</title>
		<description><![CDATA[Problem
Your host (ie dreamhost) for deploying applications doesn&#8217;t have the gems you are using in your development.
Solution
After freezing your rails gems with rake rails:freeze:gems, freeze the rest of your gems, not with rake gems:freeze gem=GEM_NAME, as used in previous versions of rails, but with:
rake gems:unpack
]]></description>
		<link>http://www.42.mach7x.com/2009/09/08/freezing-gems-other-than-rails-on-2-3-4/</link>
			</item>
	<item>
		<title>Rails XSS vulnerability</title>
		<description><![CDATA[Problem
There was a warning about an XSS vulnerability in Ruby on Rails. More details can be found here.
Solution
Upgrade to the most recent (fixed) Rails version (2.3.4):
sudo gem install rails
]]></description>
		<link>http://www.42.mach7x.com/2009/09/04/rails-xss-vulnerability/</link>
			</item>
	<item>
		<title>RubyGem version error: rack(0.3.0 not ~&gt; 1.0.0)</title>
		<description><![CDATA[Problem
Trying to deploy in dreamhost with capistrano you get the error:
RubyGem version error: rack(0.3.0 not ~> 1.0.0) 
Solution
Log in with ssh to your dreamhost account and then install the newer version of rack that is not yet installed in dreamhost:
gem install rack
That assumes that you have followed the instructions for setting up your local gems [...]]]></description>
		<link>http://www.42.mach7x.com/2009/08/24/rubygem-version-error-rack0-3-0-not-1-0-0/</link>
			</item>
</channel>
</rss>
