<?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>42 &#187; ruby on rails</title>
	<atom:link href="http://www.42.mach7x.com/tag/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.42.mach7x.com</link>
	<description>Thoughts and tips about programming with Ruby on Rails</description>
	<lastBuildDate>Thu, 09 Sep 2010 09:28:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>God gem problem unpacking with Rails 2.3.2</title>
		<link>http://www.42.mach7x.com/2010/08/06/god-gem-problem-unpacking-with-rails-2-3-2/</link>
		<comments>http://www.42.mach7x.com/2010/08/06/god-gem-problem-unpacking-with-rails-2-3-2/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 11:14:16 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[God gem]]></category>
		<category><![CDATA[Rails 2.3.2]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=212</guid>
		<description><![CDATA[Problem When using the god gem in a Rails 2.3.2 application, when you unpack (freeze) the god gem with : sudo rake gems:unpack it creates the god drectory in vendor/gems with root owner, and group permissions. Solution Remember to change owner and group for the folder sudo chown -R user_name vendor/gems/god-0.11.0 sudo chown -R user_name [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
When using the god gem in a Rails 2.3.2 application, when you unpack (freeze) the god gem with :</p>
<p><span class="code">sudo rake gems:unpack</span></p>
<p>it creates the god drectory in vendor/gems with root owner, and group permissions.</p>
<p><strong>Solution</strong><br />
Remember to change owner and group for the folder</p>
<p><span class="code">sudo chown -R user_name vendor/gems/god-0.11.0<br />
sudo chown -R user_name vendor/gems/god-0.11.0</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/08/06/god-gem-problem-unpacking-with-rails-2-3-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>406 Not Acceptable &#8211; Princely &#8211; Dreamhost</title>
		<link>http://www.42.mach7x.com/2010/04/22/406-not-acceptable-princely-dreamhost/</link>
		<comments>http://www.42.mach7x.com/2010/04/22/406-not-acceptable-princely-dreamhost/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 10:14:42 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Prince XML]]></category>
		<category><![CDATA[princely]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=193</guid>
		<description><![CDATA[Problem You get a &#8217;406 Not Acceptable&#8217; response from the web server when you try to use the princely plugin for generating pdf on a Ruby on Rails application hosted on dreamhost. Solution Having tried the &#8216;Extra Web Security&#8217; settings in dreamhost Web panel, and setting them on/off did not get very far. Also setting [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You get a &#8217;406 Not Acceptable&#8217;  response from the web server when you try to use the princely plugin for generating pdf on a Ruby on Rails application hosted on dreamhost.</p>
<p><strong>Solution</strong><br />
Having tried the &#8216;Extra Web Security&#8217; settings in dreamhost Web panel, and setting them on/off did not get very far.<br />
Also setting up an .htaccess file didn&#8217;t seem to make any difference.<br />
So the mod_security settings did not seem to be the cause of the problem.<br />
Having a look at the apache error log files which in the case of the dreamhost ps are in /usr/local/dh/apache2/logs/apache2-ps_name it turns out that the problem was that the path for the prince binary was not setting up correctly in the file vendor/plugins/princely/lib/prince.rb on line 26.<br />
A quick hack to make it work until finding the reason for the problem is to hardcode the path to the prince binary, so:<br />
<span class="code">@exe_path = `which prince`.chomp<br />
if @exe_path.nil?<br />
  @exe_path=&#8217;/usr/local/bin/prince&#8217;<br />
end</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/04/22/406-not-acceptable-princely-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NoMethodError: Attempt to call private method in using Geokit rake task</title>
		<link>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/</link>
		<comments>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 12:32:56 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Geokit]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=159</guid>
		<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>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
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.</p>
<p><strong>Solution</strong><br />
Use the method save instead of update as suggested in the book.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NoMethodError: undefined method `timeout=&#8217; for Geokit::Geocoders:Module</title>
		<link>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/</link>
		<comments>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 11:32:29 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Geokit]]></category>
		<category><![CDATA[Undefined method]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=157</guid>
		<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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
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.</p>
<p><strong>Solution</strong><br />
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  file as :<br />
<span class="code">GeoKit::Geocoders::request_timeout = 3</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pdf with .doc templates using prawn in Ruby on Rails</title>
		<link>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/</link>
		<comments>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 13:21:48 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[2.3.4]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[doc]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[odt]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[prawn]]></category>
		<category><![CDATA[prawnto]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=138</guid>
		<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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to generate pdf documents in your Ruby on Rails app using .doc templates.</p>
<p><strong>Solution</strong><br />
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).</p>
<p>Open the saved .odt document and export to pdf, making sure you use &#8216;Losless compression&#8217; in the General Options section.</p>
<p>Use imagemagick&#8217;s convert to make the pdf file to an image (setting the density to your requirements &#8211; default is 72dpi):</p>
<p><span class="code">convert -density 150 one.pdf one.png</span></p>
<p>Copy the image one.png to your rails image directory (public/images).</p>
<p>Use the image as a background to the pdf created by prawnto (install plugin if you don&#8217;t have it) with:</p>
<p><span class="code">templ=&#8221;#{RAILS_ROOT}/public/images/one.png&#8221;<br />
pdf.image(templ, {:position => :center, :vposition => :top, :scale => 0.215})</span></p>
<p>Put the database field(s) text on position (you&#8217;ll have to play around with the coordinates to get it right), like:</p>
<p><span class="code">pdf.font &#8220;#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf&#8221;, :size => 9<br />
pdf.text &#8220;#{@model_name.fielda_name}&#8221;, :at => [100,530]<br />
pdf.text &#8220;#{@model_name.fieldb_name}&#8221;, :at => [100,510] &#8230;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails XSS vulnerability</title>
		<link>http://www.42.mach7x.com/2009/09/04/rails-xss-vulnerability/</link>
		<comments>http://www.42.mach7x.com/2009/09/04/rails-xss-vulnerability/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 12:39:16 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[2.3.4]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=129</guid>
		<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>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
There was a warning about an XSS vulnerability in Ruby on Rails. More details can be found <a href="http://groups.google.com/group/rubyonrails-security/msg/7f57cd7794e1d1b4?pli=1">here</a>.</p>
<p><strong>Solution</strong><br />
Upgrade to the most recent (fixed) Rails version (2.3.4):</p>
<p><span class="code">sudo gem install rails</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/09/04/rails-xss-vulnerability/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RubyGem version error: rack(0.3.0 not ~&gt; 1.0.0)</title>
		<link>http://www.42.mach7x.com/2009/08/24/rubygem-version-error-rack0-3-0-not-1-0-0/</link>
		<comments>http://www.42.mach7x.com/2009/08/24/rubygem-version-error-rack0-3-0-not-1-0-0/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 16:45:00 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[rack]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=125</guid>
		<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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Trying to deploy in dreamhost with capistrano you get the error:</p>
<p><span class="code">RubyGem version error: rack(0.3.0 not ~> 1.0.0) </span></p>
<p><strong>Solution</strong><br />
Log in with ssh to your dreamhost account and then install the newer version of rack that is not yet installed in dreamhost:</p>
<p><span class="code">gem install rack</span></p>
<p>That assumes that you have followed the instructions for setting up your local gems in dreamhost (<a href="http://wiki.dreamhost.com/index.php/Ruby_on_Rails#Using_Gems_Installed_in_Your_Home_Directory">here</a>) and you already have a ~/username/.gems directory.</p>
<p>You may probably need to also add the following to your config/environment.rb :</p>
<p><span class="code">ENV['GEM_PATH'] = &#8216;/home/USERNAME/.gems&#8217;</span></p>
<p><strong>Note 09-Sep-2009</strong><br />
It seems that according to the dreamhost wiki we need to add the following to the config/environment.rb, instead of the line above:</p>
<p><span class="code">if ENV['RAILS_ENV'] == &#8216;production&#8217;<br />
    ENV['GEM_PATH'] = &#8216;/home/USERNAME/.gems&#8217;<br />
    require &#8216;/home/USERNAME/.gems/gems/rack-1.0.0/lib/rack.rb&#8217;<br />
end</span></p>
<p>to use the locally installed rack-1.0.0 gem, instead of the rack installed by dreamhost.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/08/24/rubygem-version-error-rack0-3-0-not-1-0-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mandriva &#8211; Eclipse &#8211; Aptana RadRails</title>
		<link>http://www.42.mach7x.com/2009/06/29/mandriva-eclipse-aptana-radrails/</link>
		<comments>http://www.42.mach7x.com/2009/06/29/mandriva-eclipse-aptana-radrails/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 17:09:45 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Aptana]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=122</guid>
		<description><![CDATA[Problem You want to do a new installation of Aptana RadRails IDE in Mandriva as an eclipse plugin. Solution Install eclipse first (selecting openjdk when prompted): sudo urpmi eclipse According to the instructions here take the following steps: From the Help menu in Eclipse, select Software Updates Select the Available Sotware tab Click the &#8220;Add [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to do a new installation of Aptana RadRails IDE in Mandriva as an eclipse plugin.</p>
<p><strong>Solution</strong></p>
<ul>
<li>Install eclipse first (selecting openjdk when prompted):
<pre class="code">sudo urpmi eclipse</pre>
</li>
<li>According to the instructions <a href="http://www.aptana.com/docs/index.php/Plugging_Aptana_into_an_existing_Eclipse_configuration">here</a> take the following steps:</li>
<li>From the Help menu in Eclipse, select Software Updates</li>
<li>Select the Available Sotware tab</li>
<li>Click the &#8220;Add Site..&#8221; button.</li>
<li>Specify the Location Url update site: http://update.aptana.com/update/studio/3.4/ and click OK</li>
<li>Select the checkbox next to the added update site.</li>
<li>Click the install button.</li>
<li>Complete instruction to install from update site and restart eclipse</li>
<li>Go to &#8216;My Aptana&#8217; page and then the &#8216;Plugins&#8217; tab on the top</li>
<li>Click on Aptana Rad Rails &#8216;Get It&#8217; link and get through the next sequence of screens select &#8216;ok&#8217;.</li>
<li>Restart Eclipse and RadRails should now be installed.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/06/29/mandriva-eclipse-aptana-radrails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>undefined method `render_component&#8217; with ActiveScaffold and Rails 2.3.2</title>
		<link>http://www.42.mach7x.com/2009/06/24/undefined-method-render_component-with-activescaffold-and-rails-2-3-2/</link>
		<comments>http://www.42.mach7x.com/2009/06/24/undefined-method-render_component-with-activescaffold-and-rails-2-3-2/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 15:32:03 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Rails 2.3.2]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=120</guid>
		<description><![CDATA[Problem When using a nested (or embedded) scaffold in ActiveScaffold with Rails 2.3.2 you have the error: undefined method `render_component' Solution According to the issue here, in Rails 2.3 the render_component has been removed. Install the render_component from: script/plugin install git://github.com/lackac/render_component.git -r rails-edge and restart your server, and it should be working.]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
When using a nested (or embedded) scaffold in ActiveScaffold with Rails 2.3.2 you have the error:</p>
<pre class="code">undefined method `render_component'</pre>
<p><strong>Solution</strong><br />
According to the issue <a href="http://code.google.com/p/activescaffold/issues/detail?id=685">here</a>, in Rails 2.3 the render_component has been removed.</p>
<p>Install the render_component from:</p>
<pre class="code">script/plugin install git://github.com/lackac/render_component.git -r rails-edge</pre>
<p>and restart your server, and it should be working.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/06/24/undefined-method-render_component-with-activescaffold-and-rails-2-3-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spree installation error in Mandriva.</title>
		<link>http://www.42.mach7x.com/2009/05/01/spree-installation-error-in-mandriva/</link>
		<comments>http://www.42.mach7x.com/2009/05/01/spree-installation-error-in-mandriva/#comments</comments>
		<pubDate>Fri, 01 May 2009 12:35:10 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[installation error]]></category>
		<category><![CDATA[spree]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=103</guid>
		<description><![CDATA[Problem You are trying to install spree from the git source, following the instructions from here, but there are errors like: gem install activemerchant --version "= 1.4.1" ERROR: While generating documentation for builder-2.1.2 ... MESSAGE: Unhandled special: Special: type=17, text="" ... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You are trying to install spree from the git source, following the instructions from <a href="http://spreecommerce.com/documentation">here</a>, but there are errors like:</p>
<pre class="code">gem install activemerchant --version "= 1.4.1"
ERROR:  While generating documentation for builder-2.1.2
... MESSAGE:   Unhandled special: Special: type=17, text="<!-- HI -->"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/builder-2.1.2/ri --title Builder
    -- Easy XML Building --main README --line-numbers
    --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc
    doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.</pre>
<p><strong>Solution</strong><br />
Make sure you have the following gems installed:</p>
<pre class="code">sudo gem install builder haml echoe
</pre>
<p>and then run:</p>
<pre class="code">sudo rake gems:install</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/05/01/spree-installation-error-in-mandriva/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
