<?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>Rorra&#039;s blog &#187; Ruby</title>
	<atom:link href="http://www.rorra.com.ar/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rorra.com.ar</link>
	<description>Senior Developer</description>
	<lastBuildDate>Mon, 30 Jan 2012 07:35:15 +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>Updating sitemap_generator to upload your files to s3 with aws-s3 and aws-sdk</title>
		<link>http://www.rorra.com.ar/2012/01/30/updating-sitemap_generator-to-upload-your-files-to-s3-with-aws-s3-and-aws-sdk/</link>
		<comments>http://www.rorra.com.ar/2012/01/30/updating-sitemap_generator-to-upload-your-files-to-s3-with-aws-s3-and-aws-sdk/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 07:35:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=238</guid>
		<description><![CDATA[Recently I had to do a job where I was suppose to either find a gem that was able to generate sitemaps in rails 3 and upload it to S3, or update the current behavior of the gem sitemap_generator (which is a great gem), so I ended updated the behavior of the gem. The gem [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to do a job where I was suppose to either find a gem that was able to generate sitemaps in rails 3 and upload it to S3, or update the current behavior of the gem <a href="https://github.com/kjvarga/sitemap_generator" target="_blank">sitemap_generator</a> (which is a great gem), so I ended updated the behavior of the gem.</p>
<p>The gem already supports uploads to S3, but the problem is that it ask you to install carrierwave, and if you are already using paperclip, aws-s3 and aws-sdk, that&#8217;s not the best way to go, so what I did was to enhance the rake tasks of the gem in order to add behavior for the S3 upload and notification to the different search engines as well.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>You can check my code in this here: <a href="https://gist.github.com/1693860" target="_blank">https://gist.github.com/1693860</a></p>
<p>Something important is to add this line of code to your file config/sitemap.rb</p>
<pre name="code" class="ruby">
SitemapGenerator::Sitemap.public_path = File.join(Rails.root, "public", "system", "sitemaps").to_s
</pre>
<p>And here&#8217;s the code</p>
<pre name="code" class="ruby">
require 'aws'

class Rake::Task
  def replace &#038;block
    @actions.clear
    prerequisites.clear
    enhance &#038;block
  end
end

namespace 'sitemap' do
  desc 'Upload the sitemap files to S3 (using your configuration in config/s3.yml)'
  task :upload_to_s3 => :environment do
    if File.exist?(File.join(Rails.root, "config", "s3.yml"))

      # Load credentials
      s3_options = YAML.load_file(File.join(Rails.root, "config", "s3.yml"))[Rails.env].symbolize_keys
      bucket_name = s3_options[:bucket]
      s3_options.delete(:bucket)

      # Establish S3 connection
      AWS.config(s3_options)

      Dir.entries(File.join(Rails.root, "public", "system", "sitemaps")).each do |file_name|
        next if ['.', '..'].include? file_name
        path = "sitemaps/#{file_name}"
        file = File.join(Rails.root, "public", "system", "sitemaps", file_name)

        begin
          s3 = AWS::S3.new
          bucket = s3.buckets.create(bucket_name)

          object = bucket.objects[path]
          object.write(:file => file)
        rescue Exception => e
          raise
        end
        puts "Saved #{file_name} to S3"
      end
    end
  end
end

Rake::Task["sitemap:create"].enhance do
  Rake::Task["sitemap:upload_to_s3"].invoke
end

Rake::Task[:'sitemap:refresh'].replace do
  if File.exist?(File.join(Rails.root, "config", "s3.yml"))
    s3_options = YAML.load_file(File.join(Rails.root, "config", "s3.yml"))[Rails.env].symbolize_keys
    bucket_name = s3_options[:bucket]
    SitemapGenerator::Sitemap.ping_search_engines(:sitemap_index_url => "https://#{bucket_name}.s3.amazonaws.com/sitemaps/sitemap_index.xml.gz")
  else
    SitemapGenerator::Sitemap.ping_search_engines
  end
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2012/01/30/updating-sitemap_generator-to-upload-your-files-to-s3-with-aws-s3-and-aws-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails tickets moved from lighthouse to github</title>
		<link>http://www.rorra.com.ar/2011/05/09/rails-tickets-moved-from-lighthouse-to-github/</link>
		<comments>http://www.rorra.com.ar/2011/05/09/rails-tickets-moved-from-lighthouse-to-github/#comments</comments>
		<pubDate>Mon, 09 May 2011 05:22:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=232</guid>
		<description><![CDATA[Until now, all the tickets created for ruby on rails were being reported on lighthouse . But now, the tickets were migrated to github and you should use github in order to report tickets on ruby on rails .]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Until now, all the tickets created for ruby on rails were being reported on lighthouse <<a href="https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview">https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview</a>>.<br />
<br/><br />
<img src="https://img.skitch.com/20110509-8iwysa87e1yx2mqxi85ending2.jpg" alt="" /><br />
<br/><br />
But now, the tickets were migrated to github and you should use github in order to report tickets on ruby on rails <<a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>>.<br />
<br/><br />
<img src="https://img.skitch.com/20110501-mdxymiiwnr1hr5ha5mmykg38qa.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2011/05/09/rails-tickets-moved-from-lighthouse-to-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails 2.3.x video tutorial</title>
		<link>http://www.rorra.com.ar/2010/09/21/ruby-on-rails-2-3-x-video-tutorial/</link>
		<comments>http://www.rorra.com.ar/2010/09/21/ruby-on-rails-2-3-x-video-tutorial/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 14:02:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=213</guid>
		<description><![CDATA[While attending to the pcmasmas.com meeting, I gave an advance introduction to ruby on rails 2.3.x with haml, sass, authlogic, friendly_id and activescaffold. I prepared a set of videos in order to introduce other developers to web development with ruby on rails. You can find all those videos (without audio) here: Video 1 of 10: [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>While attending to the <a href="http://www.pcmasmas.com">pcmasmas.com</a> meeting, I gave an advance introduction to ruby on rails 2.3.x with haml, sass, authlogic, friendly_id and activescaffold.</p>
<p>I prepared a set of videos in order to introduce other developers to web development with ruby on rails.</p>
<p>You can find all those videos (without audio) here:</p>
<p><a href="http://blip.tv/file/4130315">Video 1 of 10: Creating the rails application</a><br />
<a href="http://blip.tv/file/4130348">Video 2 of 10: Setting up git</a><br />
<a href="http://blip.tv/file/4130513">Video 3 of 10: Starting the layout with haml and sass</a><br />
<a href="http://blip.tv/file/4147906">Video 4 of 10: Implementing authentication with authlogic</a><br />
<a href="http://blip.tv/file/4147810">Video 5 of 10: Creating the category and product models</a><br />
<a href="http://blip.tv/file/4147836">Video 6 of 10: Starting the administration with activescaffold</a><br />
<a href="http://blip.tv/file/4147846">Video 7 of 10: Browsing categories and products, part 1 of 2</a><br />
<a href="http://blip.tv/file/4147873">Video 8 of 10: Browsing categories and products, part 2 of 2</a><br />
<a href="http://blip.tv/file/4147915">Video 9 of 10: Better navigation with friendly_id</a><br />
<a href="http://blip.tv/file/4147962">Video 10 of 10: Improving the administration and updating it to integrate friendly_id updates</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/09/21/ruby-on-rails-2-3-x-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3 released, bundler 1.0 released!!!!</title>
		<link>http://www.rorra.com.ar/2010/08/30/rails-3-released-bundler-1-0-released/</link>
		<comments>http://www.rorra.com.ar/2010/08/30/rails-3-released-bundler-1-0-released/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 13:44:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=207</guid>
		<description><![CDATA[Rails 3.0 has been underway for a good two years, so it’s with immense pleasure that we can declare it’s finally here. We’ve brought the work of more than 1,600 contributors together to make everything better, faster, cleaner, and more beautiful. David Heinemeier Hansson So at this moment, if you run a gem install rails, [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Rails 3.0 has been underway for a good two years, so it’s with immense pleasure that we can declare it’s finally here. We’ve brought the work of more than 1,600 contributors together to make everything better, faster, cleaner, and more beautiful.
</p></blockquote>
<p>David Heinemeier Hansson</p>
<p>So at this moment, if you run a gem install rails, you will notice that it install the version 3 <img src='http://www.rorra.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Why? Because it&#8217;s stable (or it should be (A)).</p>
<p>Where to start?</p>
<p>You should start by checking the <a href="http://rubyonrails.org/screencasts/rails3/">&#8220;rails 3 screencasts&#8221;</a> that you can find on the rails website. It&#8217;s a great introduction to see the news on the rails 3 framework. As usually, you can find good videos on <a href="http://railscasts.com/">railscasts</a> about rails 3, how to migrate to rails 3, etc.</p>
<p>You can find all the improvements on the official website, but just to summarize them, in rails 3 you will find:</p>
<ol>
<li>New Active Record query engine</li>
<li>New router for Action Controller</li>
<li>New Action Mailer</li>
<li>Manage dependencies with Bundler</li>
<li>XSS protection by default</li>
<li>Ruby 1.9 Encoding support</li>
<li>Active Model: Validations, callbacks, etc for all models, so you can use other ORMs with rails in a easy way</li>
<li>Official plugin APIs (railties)</li>
<li>Rewritten internals</li>
<li>Agnosticism with jQuery, rSpec, and Data Mapper</li>
<li>Documentation</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/08/30/rails-3-released-bundler-1-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3, mysql and UTF-8</title>
		<link>http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/</link>
		<comments>http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 18:01:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=192</guid>
		<description><![CDATA[So, have you started to work with rails 3? Did you realize that your UTF-8 databases doesn&#8217;t work nice with mysql? This is because the mysql gem works with ASCII-8BIT encoding, but ruby 1.9 and rails 3 works with UTF-8 encoding, so when you create a model into the database, everything works fine, but when [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
So, have you started to work with rails 3? Did you realize that your UTF-8 databases doesn&#8217;t work nice with mysql? This is because the mysql gem works with ASCII-8BIT encoding, but ruby 1.9 and rails 3 works with UTF-8 encoding, so when you create a model into the database, everything works fine, but when you work with those models, it doesn&#8217;t works so nice and you don&#8217;t get what you stored.<br />
What&#8217;s the solution? Well, there are actually three solutions, the most recommended, use mysql2, in order to do this, edit your Gemfile and include:</p>
<pre name="code" class="ruby">
gem "mysql2"</pre>
<p>and then, edit your databases.yml file, and change the adapter to mysql2</p>
<pre name="code" class="ruby">
development:
  adapter: mysql2
  database: fun_development
  user: root
  password:
  encoding: utf8</pre>
<p>Another solution, is just instead of using the &#8220;mysql&#8221; gem, use the &#8220;ruby-mysql&#8221; gem, but it&#8217;s pretty slow because it&#8217;s a 100% ruby gem.</p>
<pre name="code" class="ruby">
gem "ruby-mysql"</pre>
<p>The last solution is a monkey patch, but its also slow to use it, so I really recommend using the mysql 2 gem</p>
<pre name="code" class="ruby">
require 'mysql'

class Mysql::Result
  def encode(value, encoding = "utf-8")
    String === value ? value.force_encoding(encoding) : value
  end

  def each_utf8(&#038;block)
    each_orig do |row|
      yield row.map {|col| encode(col) }
    end
  end
  alias each_orig each
  alias each each_utf8

  def each_hash_utf8(&#038;block)
    each_hash_orig do |row|
      row.each {|k, v| row[k] = encode(v) }
      yield(row)
    end
  end
  alias each_hash_orig each_hash
  alias each_hash each_hash_utf8
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Contributing to ruby on rails source code is so easy</title>
		<link>http://www.rorra.com.ar/2010/07/29/contributing-to-ruby-on-rails-source-code-is-so-easy/</link>
		<comments>http://www.rorra.com.ar/2010/07/29/contributing-to-ruby-on-rails-source-code-is-so-easy/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 16:59:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=186</guid>
		<description><![CDATA[I finally made my first contribution to rails, although it&#8217;s not a big fix nor anything like that, is a way to get started. If you have read my last posts, you will see how to install and works with rails edge, but now I&#8217;ll explain how to setup a good rails environment to live [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<br/><br />
I finally made my first <a href="http://github.com/rails/rails/commit/aa054c35f7809b57ecb105e485e4436d9fe37b1b">contribution to rails</a>, although it&#8217;s not a big fix nor anything like that, is a way to get started.<br />
<br/><br />
If you have read my last posts, you will see how to install and works with rails edge, but now I&#8217;ll explain how to setup a good rails environment to live in the edge and to help ruby on rails community by checking the issues posted on <a href="https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets">lighthouseapp.com</a> to see if they are a real bug or not, to create patches for bugs, or why not, to create a new functionality for the rails framework.<br />
<br/><br />
Supposing that you already installed the last version of rails, you will need to get the rails code checked out from github, and make your demo project to use that version, so you can modify that version to create fixes, to test fixes, etc.</p>
<pre name="code" class="ruby">
git checkout http://github.com/rails/rails.git
</pre>
<p><br/><br />
Now that you just create an application for doing test/development</p>
<pre name="code" class="ruby">
rails new my_app
</pre>
<p><br/><br />
Edit the Gemfile of my_app (my_app/Gemfile) to use the rails code you are going to work with, by giving the rails gem a parameter :path where your code of ruby on rails is installed</p>
<pre name="code" class="ruby">
gem 'rails', :path => File.expand_path('../../rails',  __FILE__)
</pre>
<p><br/><br />
And that&#8217;s all, now you can follow this <a href="http://edgeguides.rubyonrails.org/contributing_to_rails.html">guide</a> to know how to work with git in order to post valid patches.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/07/29/contributing-to-ruby-on-rails-source-code-is-so-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.0 RC Released!!!!</title>
		<link>http://www.rorra.com.ar/2010/07/27/rails-3-0-rc-released/</link>
		<comments>http://www.rorra.com.ar/2010/07/27/rails-3-0-rc-released/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 15:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=178</guid>
		<description><![CDATA[So finally, rails 3.0 RC was released, cool news because rails 3.0 brings a lot of updates and it will be very fun to develop for rails 3.0. I wonder how much work would be out there migrating rails 2.x to rails 3.x versión. Rails 3.0 RC is out just after 21 hours bunder 1.0.0.RC.1 [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>So finally, rails 3.0 RC was released, cool news because rails 3.0 brings a lot of updates and it will be very fun to develop for rails 3.0. I wonder how much work would be out there migrating rails 2.x to rails 3.x versión.<br />
Rails 3.0 RC is out just after 21 hours bunder 1.0.0.RC.1 was released, was it really a coincidence? Yeah sure&#8230;<br />
So how to start playing with rails 3.0.RC? Pretty easy, first, install <a href="http://rvm.beginrescueend.com/">rvm</a>, after that, lets install ruby 1.9.2 RC 2</p>
<pre class="ruby">
rvm install 1.9.2</pre>
<p>Now let&#8217;s use ruby 1.9.2</p>
<pre name="code" class="ruby">
rvm 1.9.2</pre>
<p>Then we will install bundler, because we are using rvm, we won&#8217;t use sudo at anytime</p>
<pre name="code" class="ruby">
gem install bundler -v 1.0.0.rc.1</pre>
<p>And now we can install rails rc 1</p>
<pre name="code" class="ruby">
gem install rails --pre</pre>
<p>We can start playing with rails 3.0</p>
<pre name="code" class="ruby">
rails app my_app_name
cd my_app_name
bundle install</pre>
<p>But finally, instead of locking your development on rails 3.0.RC 1, work with the latest version of rails that is being developed (because we will find bugs in the RC), edit the Gemfile inside your application, and do these modifications</p>
<pre name="code" class="ruby">
#gem 'rails', '3.0.0.rc'

# Bundle edge Rails instead:
gem 'rails', :git => 'git://github.com/rails/rails.git'</pre>
<p>Now update your app to work with the latest version of rails</p>
<pre name="code" class="ruby">
bundle install</pre>
<p>And that&#8217;s all <img src='http://www.rorra.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
You can report any bugs you find on <a href="https://rails.lighthouseapp.com/projects/8994-ruby-on-rails">https://rails.lighthouseapp.com/projects/8994-ruby-on-rails</a>, and also check the bugs there, reproduce them and confirm that is really a bug or not, and don&#8217;t forget, you are also testing bundler 1.0.0.RC.1, so if you find any issue with bundler, you can report your issues on <a href="http://github.com/carlhuda/bundler/issues">http://github.com/carlhuda/bundler/issues</a>.<br />
<strong>Remember, this is your opportunity to give something back to the open source community</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/07/27/rails-3-0-rc-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing RubyDebug with ruby 1.9.2 and rails 3 to use RubyMine</title>
		<link>http://www.rorra.com.ar/2010/07/24/installing-rubydebug-with-ruby-1-9-2-and-rails-3-to-use-rubymine/</link>
		<comments>http://www.rorra.com.ar/2010/07/24/installing-rubydebug-with-ruby-1-9-2-and-rails-3-to-use-rubymine/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 20:26:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=171</guid>
		<description><![CDATA[So you are trying to install ruby-debug to debug rails applications (or perhaps ruby-debug-ide for RubyMine) and you are having problems with it, because you have ruby 1.8.7 for your system, and you are using rvm in order to user ruby 1.9.2 to test rails edge. The first thing to notice, is that all of [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
So you are trying to install ruby-debug to debug rails applications (or perhaps ruby-debug-ide for RubyMine) and you are having problems with it, because you have ruby 1.8.7 for your system, and you are using rvm in order to user ruby 1.9.2 to test rails edge.</p>
<p>The first thing to notice, is that all of the sources that you have installed with rvm are located in $rvm_path/src, so in case you are using ruby 1.9.2 rc 2 as I&#8217;m doing right now, the installation is pretty easy</p>
<pre name="code" class="ruby">
gem install ruby-debug-ide19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-rc2/
</pre>
<p>But for sure, if you are using ruby 1.9.1 or any other version, you can easily do a ls $rvm_path/src to find the right location to compile ruby-debug-ide19 into your system.</p>
<p>Now, you can add the gem to the Gemfile if you are planning to debug from the console</p>
<pre name="code" class="ruby">
gem 'ruby-debug19', :require => 'ruby-debug', :group => :development
</pre>
<p>And then run</p>
<pre name="code" class="ruby">
rails s --debug
</pre>
<p>Or if you are using rubymine, the debug will start although it&#8217;s not working yet, hopefully it will be working before rubymine 2.3.5 is released, because nobody wants to use rails3 without ruby 1.9.2, or at least I don&#8217;t want to do that <img src='http://www.rorra.com.ar/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/07/24/installing-rubydebug-with-ruby-1-9-2-and-rails-3-to-use-rubymine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating radiant 0.9, globalize and GeoIP</title>
		<link>http://www.rorra.com.ar/2010/01/10/integrating-radiant-globalize-and-geoip/</link>
		<comments>http://www.rorra.com.ar/2010/01/10/integrating-radiant-globalize-and-geoip/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 09:28:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=156</guid>
		<description><![CDATA[After downloading and using radiant 0.9 and globalize, I realized that I wanted to redirect the users by default with their geo location. So I installed GeoIP and then I had to do these little modifications to the Globalize plugin. First, I edit the file config/environment.rb and added this line, in order to load GeoIP [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
After <a href="http://www.rorra.com.ar/en/2009/12/30/installing-radiant-09-with-multiple-language-support/">downloading and using radiant 0.9 and globalize</a>, I realized that I wanted to redirect the users by default with their geo location.<br />
So I installed <a href="http://github.com/cjheath/geoip/">GeoIP</a> and then I had to do these little modifications to the Globalize plugin.<br />
First, I edit the file config/environment.rb and added this line, in order to load GeoIP with the application</p>
<pre name="code" class="ruby">
config.gem 'geoip'
</pre>
<p>Then I updated the file vendor/extensions/globalize2/lib/globalize2/application_controller_extensions.rb</p>
<pre name="code" class="ruby">
module Globalize2
  module SiteControllerExtensions
    def self.included(base)
      base.class_eval do
        alias_method_chain :find_page, :globalize

        alias_method_chain :show_page, :homepage_redir
      end
    end

    def show_page_with_homepage_redir
      url = params[:url]
      if Array === url
        url = url.join('/')
      else
        url = url.to_s
      end

      if url == '/'
        locale = params[:locale] || cookies[:locale] || session[:locale] || Globalize2Extension.ip_lookup(request.remote_ip)
        redirect_to CGI.unescape('/' + locale + '/') and return
      end

      show_page_without_homepage_redir
    end

    def find_page_with_globalize(url)
      globalized_url = '/' + I18n.locale + '/' + url
      find_page_without_globalize(globalized_url)
    end
  end
end
</pre>
<p>So, as you can see on the code, I also check if the user has the language selected in a cookie, and when the user selects (or get a locale by default), I set the cookie with the locale, so the next time the user came into the site, he will see the last language selected.<br />
Finally, I updated the file vendor/extensions/globalize2/globalize2_extension.rb and added the following method, where I get the country code from the user, and I set the locale based on his country ip, or the default locale.</p>
<pre name="code" class="ruby">
  def ip_lookup(ip)
    g = GeoIP.new( File.join(File.dirname(__FILE__), '..', '..', 'gems', 'geoip-0.8.6', 'GeoIP.dat'))
    r = g.country(ip)
    country_code = r[3]
    case country_code
      when 'DE'
        'de'
      when 'GB'
        'uk'
      when 'AU'
        'au'
      when 'FR'
        'fr'
      when ' US'
        'us'
      else
        'us'
    end
  end
</pre>
<p>And finally, we need to tell Radiant to load the GeoIP library, so in the same file, we add</p>
<pre name="code" class="ruby">
  extension_config do |config|
    config.gem 'geoip', :source =&gt; 'http://github.com'
  end
</pre>
<p>So that&#8217;s all, now you have GeoIP working with globalize and Radiant 0.9 <img src='http://www.rorra.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/01/10/integrating-radiant-globalize-and-geoip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Radiant &amp; Globalize: Redirecting the user to their language site</title>
		<link>http://www.rorra.com.ar/2010/01/09/radiant-globalize-redirecting-the-user/</link>
		<comments>http://www.rorra.com.ar/2010/01/09/radiant-globalize-redirecting-the-user/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 09:30:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rorra.com.ar/?p=159</guid>
		<description><![CDATA[After installing Radiant 0.9 and Globalize, I realized I had to redirect the user to their language site. So, if the user has been assigned to the locale en, when he vist http://mysite.com he should be redirected to http://mysite.com/en Why? Because I had some files under images with locales, and I had some flash issues [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7024942925419851";
/* 468x60, creado 26/03/09 */
google_ad_slot = "2077812753";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
After installing <a href="http://www.rorra.com.ar/2009/12/30/installing-radiant-09-with-multiple-language-support/">Radiant 0.9 and Globalize</a>, I realized I had to redirect the user to their language site.<br />
<br/><br />
So, if the user has been assigned to the locale en, when he vist http://mysite.com he should be redirected to http://mysite.com/en<br />
<br/><br />
Why? Because I had some files under images with locales, and I had some flash issues that were not going to work from the homepage address.<br />
<br/><br />
So I ended updating the file vendor/extensions/globalize2/lib/globalize2/site_controller_extensions.rb</p>
<pre name="code" class="ruby">
module Globalize2
  module SiteControllerExtensions
    def self.included(base)
      base.class_eval do
        alias_method_chain :find_page, :globalize

        alias_method <img src='http://www.rorra.com.ar/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> riginal_show_page, :show_page
        alias_method :show_page, :check_homepage_redir

      end
    end

    def check_homepage_redir
      url = params[:url]
      if Array === url
        url = url.join('/')
      else
        url = url.to_s
      end

      if url == '/'
        locale = params[:locale] || cookies[:locale] || session[:locale] || Globalize2Extension.ip_lookup(request.remote_ip)
        redirect_to CGI.unescape('/' + locale + '/') and return
      end

      original_show_page
    end

    def find_page_with_globalize(url)
      globalized_url = '/' + I18n.locale + '/' + url
      find_page_without_globalize(globalized_url)
    end
  end
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rorra.com.ar/2010/01/09/radiant-globalize-redirecting-the-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

