<?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>I On Rails</title>
	<atom:link href="http://ionrails.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ionrails.com</link>
	<description>Keeping an &#039;I&#039; on RoR</description>
	<lastBuildDate>Sat, 14 Jan 2012 07:17:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Rails 3 Performance</title>
		<link>http://ionrails.com/2011/05/15/rails-3-performance/</link>
		<comments>http://ionrails.com/2011/05/15/rails-3-performance/#comments</comments>
		<pubDate>Sun, 15 May 2011 17:15:34 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[performance]]></category>
		<category><![CDATA[rails 3 performance]]></category>
		<category><![CDATA[rails performance]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=718</guid>
		<description><![CDATA[Great article on Rails 3 performance Rails 3 Performance &#8211; Not Good Enough]]></description>
			<content:encoded><![CDATA[<p>Great article on Rails 3 performance <a href="http://blog.tstmedia.com/news_article/show/86942?referrer_id=308069">Rails 3 Performance &#8211; Not Good Enough</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/05/15/rails-3-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails and rake db:migrate in Production Mode</title>
		<link>http://ionrails.com/2011/05/07/rails-rake-db-migrate-in-production-mode/</link>
		<comments>http://ionrails.com/2011/05/07/rails-rake-db-migrate-in-production-mode/#comments</comments>
		<pubDate>Sat, 07 May 2011 21:01:53 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[production mode]]></category>
		<category><![CDATA[rails c]]></category>
		<category><![CDATA[rails console]]></category>
		<category><![CDATA[rails s]]></category>
		<category><![CDATA[rails server]]></category>
		<category><![CDATA[rake db:migrate]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=713</guid>
		<description><![CDATA[There are some inconsistencies when running rails server, rails console and rake db:migrate in production mode. There really should be a standard way to let the rails and rake commands know you want to execute them in production mode. Starting Rails Server in Production Mode Starting Rails Console in Production Mode rake db:migrate in Production [...]]]></description>
			<content:encoded><![CDATA[<p>There are some inconsistencies when running rails server, rails console and rake db:migrate in production mode. There really should be a standard way to let the rails and rake commands know you want to execute them in production mode.</p>
<h3>Starting Rails Server in Production Mode</h3>
<pre class="brush: ruby; title: ; notranslate">
rails server -e production
OR
rails s -e production
</pre>
<h3>Starting Rails Console in Production Mode</h3>
<pre class="brush: ruby; title: ; notranslate">
rails console production
OR
rails c production
</pre>
<h3>rake db:migrate in Production Mode</h3>
<pre class="brush: ruby; title: ; notranslate">
rake db:migrate RAILS_ENV=production
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/05/07/rails-rake-db-migrate-in-production-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clearing All Rails Log Files with Rake Task</title>
		<link>http://ionrails.com/2011/04/26/clearing-all-rails-log-files-with-rake-task/</link>
		<comments>http://ionrails.com/2011/04/26/clearing-all-rails-log-files-with-rake-task/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 18:12:37 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Commands]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[log files]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[rake log:clear]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=706</guid>
		<description><![CDATA[In order to clear all of your Rails log files development.log, production.log, server.log and test.log with a rake task, type: This is mainly useful while under development. Be careful with this as it will clear out your production.log file as well!]]></description>
			<content:encoded><![CDATA[<p>In order to clear <strong>all</strong> of your Rails log files development.log, production.log, server.log and test.log with a rake task, type:</p>
<pre class="brush: ruby; title: ; notranslate">
rake log:clear
</pre>
<p>This is mainly useful while under development. Be careful with this as it will clear out your production.log file as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/04/26/clearing-all-rails-log-files-with-rake-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Custom XML Responses in Rails</title>
		<link>http://ionrails.com/2011/04/16/building-xml-response-in-rails/</link>
		<comments>http://ionrails.com/2011/04/16/building-xml-response-in-rails/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 08:09:11 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[building custom xml]]></category>
		<category><![CDATA[building xml]]></category>
		<category><![CDATA[custom xml]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[response xml]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml builder]]></category>
		<category><![CDATA[xml response]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=699</guid>
		<description><![CDATA[Assume you have a CitiesController with just one action capital_city, which doesn&#8217;t need any of the RESTful actions. I set up a custom route for this one action. The capital_city action returns the xml like the following, for example: Here is what the entry in the routes.rb file looks like: Your controller may look something [...]]]></description>
			<content:encoded><![CDATA[<p>Assume you have a CitiesController with just one action capital_city, which doesn&#8217;t need any of the RESTful actions. I set up a custom route for this one action. </p>
<p>The capital_city action returns the xml like the following, for example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;list&gt;
  &lt;item&gt;Washington D.C.&lt;/item&gt;
&lt;/list&gt;
</pre>
<p>Here is what the entry in the routes.rb file looks like:</p>
<pre class="brush: ruby; title: ; notranslate">
  get &quot;cities/capital_city&quot;
</pre>
<p>Your controller may look something like below, where call to City.capital_city is just a named scope defined in your model which takes a country name as an argument and returns the name of the capital city.</p>
<pre class="brush: ruby; title: ; notranslate">
class CitiesController &lt; ApplicationController

  # GET /cities/capital_city.xml?country=United States
  def capital_city
    @capital_city = City.capital_city(params[:country])

    respond_to do |format|
      format.xml # COMMENT THIS OUT TO USE YOUR CUSTOM XML RESPONSE INSTEAD  { render :xml =&gt; @capital_city }
    end
  end
end
</pre>
<p>Therefore, you need to create a xml builder file in place where you would normally expect the builder file to be, which is the view.<br />
So, in this case, you would expect the builder file to be under views/cities/capital_city.xml.builder</p>
<p>Your views/cities/capital_city.xml.builder would contain:</p>
<pre class="brush: ruby; title: ; notranslate">
xml.instruct!
xml.list do
  if @capital_city.empty?
    xml.item
  else
    xml.item @capital_city[0]['name']
  end
end
</pre>
<p>Then you should be able to hit http://localhost:3000cities/capital_city.xml?country=United States and see the xml response.</p>
<p>I recommend switching the HTTP method from &#8216;get&#8217; to &#8216;post&#8217; instead in the routes file, if for example, you are using the xml response for an AJAX request. However, for testing purposes it&#8217;s easier to use the get method first if you want to test it in your browser without special tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/04/16/building-xml-response-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bundle Install &#8211; missing mysql.h</title>
		<link>http://ionrails.com/2011/04/13/bundle-install-missing-mysql-h/</link>
		<comments>http://ionrails.com/2011/04/13/bundle-install-missing-mysql-h/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 17:57:51 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[Installing]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[bundle install]]></category>
		<category><![CDATA[gem install]]></category>
		<category><![CDATA[installing mysql gem]]></category>
		<category><![CDATA[mamp]]></category>
		<category><![CDATA[missing]]></category>
		<category><![CDATA[mysql.h]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=695</guid>
		<description><![CDATA[If you&#8217;re seeing the following error: The way I was able to resolve it was to follow Boonedocks.net, since I&#8217;m also using MAMP for its MySQL Database instance. The only difference is that I already had MAMP 1.9.4 installed and so I had to download the MAMP_components_1.9.dmg which contains the mysql-5.1.44 source code. MAMP 1.9.4 [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re seeing the following error:</p>
<pre class="brush: ruby; title: ; notranslate">
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
</pre>
<p>The way I was able to resolve it was to follow <a href="http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html">Boonedocks.net</a>, since I&#8217;m also using MAMP for its MySQL Database instance.</p>
<p>The only difference is that I already had MAMP 1.9.4 installed and so I had to download the MAMP_components_1.9.dmg which contains the mysql-5.1.44 source code. MAMP 1.9.4 comes with mysql-5.1.44 but I needed the source code so I can compile libraries so the mysql Gem can link against it.</p>
<p>Here are the steps, assuming you already have MAMP or a separate standalone MySQL instance installed. </p>
<p>However, you should be able to follow similar instructions even if you don&#8217;t have MAMP installed. If you don&#8217;t have MAMP installed, correct the paths referenced below, as these ones below reference the MAMP directory.</p>
<ol>
<li>Figure out which version of mysql you have installed by running mysql from the prompt or checking your phpinfo page</li>
<li>Download and Install the MAMP_components_1.x.dmg or the MySQL source code. The version should match your current mysql version though in order to avoid issues. Inside the MAMP Components, you should see a mysql tarball. You need to untar/unzip that.</li>
<li>cd into the mysql-5.x source directory</li>
<li>Assuming you have MAMP installed, type the following: ./configure &#8211;with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock &#8211;without-server &#8211;prefix=/Applications/MAMP/Library</li>
<li>Execute: make -j2</li>
<li>Execute: cp libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql</li>
<li>Execute: mkdir /Applications/MAMP/Library/include</li>
<li>Execute: cp -R include /Applications/MAMP/Library/include/mysql</li>
<li>Execute: sudo env ARCHFLAGS=&#8221;-arch i386&#8243; gem install mysql &#8212; &#8211;with-mysql-config=/Applications/MAMP/Library/bin/mysql_config</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/04/13/bundle-install-missing-mysql-h/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using lambda with named scopes in Rails 3</title>
		<link>http://ionrails.com/2011/04/12/using-lambda-with-named-scopes-in-rails-3/</link>
		<comments>http://ionrails.com/2011/04/12/using-lambda-with-named-scopes-in-rails-3/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 23:54:29 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[models]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[activerelation]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[named scopes]]></category>
		<category><![CDATA[scopes]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=690</guid>
		<description><![CDATA[You can define an ActiveRelation named scope inside your model Address, for example, like so:]]></description>
			<content:encoded><![CDATA[<p>You can define an ActiveRelation named scope inside your model Address, for example, like so:</p>
<pre class="brush: ruby; title: ; notranslate">
class Address &lt; ActiveRecord::Base
  scope :search, lambda {|query| where([&quot;name LIKE ?&quot;, &quot;%#{query}%&quot;])}
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/04/12/using-lambda-with-named-scopes-in-rails-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ActiveRecord destroy method</title>
		<link>http://ionrails.com/2011/04/12/activerecord-destroy-method/</link>
		<comments>http://ionrails.com/2011/04/12/activerecord-destroy-method/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 23:06:40 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[destroy]]></category>
		<category><![CDATA[frozen?]]></category>
		<category><![CDATA[TypeError]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=688</guid>
		<description><![CDATA[Once you destroy a record, the object becomes frozen. Call the frozen? method on the referenced object before and after calling destroy to see the difference. If you try to manipulate the object after the object is ‘frozen’, you’ll get a TypeError: can’t modify frozen hash]]></description>
			<content:encoded><![CDATA[<p>Once you destroy a record, the object becomes frozen. Call the frozen? method on the referenced object before and after calling destroy to see the difference. If you try to manipulate the object after the object is ‘frozen’, you’ll get a TypeError: can’t modify frozen hash</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/04/12/activerecord-destroy-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Makes Writing JavaScript Fun Again</title>
		<link>http://ionrails.com/2011/01/27/jquery-makes-writing-javascript-fun-again/</link>
		<comments>http://ionrails.com/2011/01/27/jquery-makes-writing-javascript-fun-again/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 04:05:32 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Dr. Doris Chen]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Silicon Valley HTML5 Users Group]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=686</guid>
		<description><![CDATA[Nick Pink attended the Silicon Valley HTML5 Users Group meeting recently and here are his notes which I am posting with his permission. Last night I went a meetup sponsored by the Silicon Valley HTML5 Users Group called &#8220;jQuery Makes Writing JavaScript Fun Again&#8221;. The speaker, Dr. Doris Chen of Microsoft, talked specifically about AJAX [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nickpink.com">Nick Pink</a> attended the Silicon Valley HTML5 Users Group meeting recently and here are his notes which I am posting with his permission. </p>
<p>Last night I went a meetup sponsored by the Silicon Valley HTML5 Users Group called &#8220;jQuery Makes Writing JavaScript Fun Again&#8221;.  The speaker, Dr. Doris Chen of Microsoft, talked specifically about AJAX so I thought I would post a few points of the talk here.</p>
<ul>
<ol>&quot;Naked&quot; AJAX is complex and difficult to wield</ol>
<ol>Using a JavaScript toolkit to &quot;wrap up&quot; the messy details is helpful</ol>
<ol>jQuery is the most popular AJAX toolkit and is free</ol>
<ol>Microsoft hearts jQuery and is contributing to a few new plugins</ol>
<ol><strong>Templates plugin</strong> allows you to make a template for inserting dynamic data</ol>
<ol><strong>Datalink plugin</strong> helps with keeping the UI and form data synchronized</ol>
<ol><strong>Globalization plugin</strong> has international widgets, you can easily switch languages</ol>
</ul>
<p>You can view the slideshow <a href="http://www.slideshare.net/doris1/j-query-dorischenmeetuphtml5?from=ss_embed">jQuery Makes Writing JavaScript Fun Again</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/01/27/jquery-makes-writing-javascript-fun-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby vs Python</title>
		<link>http://ionrails.com/2011/01/25/ruby-vs-python/</link>
		<comments>http://ionrails.com/2011/01/25/ruby-vs-python/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 07:08:27 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[python vs ruby]]></category>
		<category><![CDATA[ruby vs python]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=683</guid>
		<description><![CDATA[Python vs. Ruby: A Battle to The Death]]></description>
			<content:encoded><![CDATA[<p><a href="http://vimeo.com/9471538">Python vs. Ruby: A Battle to The Death</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/01/25/ruby-vs-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create a Shorter Alias for Public DNS Hostname</title>
		<link>http://ionrails.com/2011/01/20/how-to-create-a-shorter-alias-for-public-dns-hostname/</link>
		<comments>http://ionrails.com/2011/01/20/how-to-create-a-shorter-alias-for-public-dns-hostname/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 07:32:57 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[ec2]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[public dns]]></category>
		<category><![CDATA[public dns alias]]></category>
		<category><![CDATA[shorter name]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh config]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=676</guid>
		<description><![CDATA[After you&#8217;ve created your Amazon EC2 instance, set up Security Groups for ssh, set up your key pair, you will realize that your Public DNS for your EC2 instance is super long and very hard to remember. You also wish you could exclude having to type the &#34;username@&#34; prefix when you ssh to the server. [...]]]></description>
			<content:encoded><![CDATA[<p>After you&#8217;ve created your Amazon EC2 instance, set up Security Groups for ssh, set up your key pair, you will realize that your Public DNS for your EC2 instance is super long and very hard to remember. You also wish you could exclude having to type the &quot;username@&quot; prefix when you ssh to the server.</p>
<p>At this point you wish you could create a shorter name (alias) for it, right? Well you can!</p>
<p>One solution is to add to your ~/.ssh/config file something like the following to create your alias to your Public DNS:</p>
<pre class="brush: ruby; title: ; notranslate">
Host ec2
  Hostname ec2-x-x-x-x.compute-x.amazonaws.com
  User ubuntu
</pre>
<p>The Host <em>ec2</em> is the alias. You can call it whatever you like.</p>
<p>Replace the sample Hostname with yours. You can see what your Public DNS is by looking in your EC2 <em>Navigation</em> pane, in the <em>Description</em> tab.</p>
<p>Replace ubuntu above with the username the instance you&#8217;re using has available.</p>
<p>In order to ssh to your Public DNS, you can do the following:</p>
<pre class="brush: ruby; title: ; notranslate">
ssh ec2
</pre>
<p>instead of having to do this:</p>
<pre class="brush: ruby; title: ; notranslate">
ssh ubuntu@ec2-x-x-x-x.compute-x.amazonaws.com
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/01/20/how-to-create-a-shorter-alias-for-public-dns-hostname/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

