<?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>Anton Zolotov &#187; Ruby on Rails</title>
	<atom:link href="http://antonzolotov.com/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://antonzolotov.com</link>
	<description>Anton Zolotov&#039;s Blog</description>
	<lastBuildDate>Wed, 31 Aug 2011 12:00:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Filling out text, select, radio &amp; check fields with capybara and cucumber</title>
		<link>http://antonzolotov.com/2011/08/25/filling-out-text-select-radio-check-fields-with-capybara-and-cucumber/</link>
		<comments>http://antonzolotov.com/2011/08/25/filling-out-text-select-radio-check-fields-with-capybara-and-cucumber/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 21:49:21 +0000</pubDate>
		<dc:creator>Anton Zolotov</dc:creator>
				<category><![CDATA[cucumber]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://antonzolotov.com/?p=415</guid>
		<description><![CDATA[Using capybara&#8217;s standard web steps.rb often times isn&#8217;t very dry. For a scenario where a user completes a lengthy form, with text &#038; select fields as well as radio and check buttons, I refactored the code, leading to a much cleaner scenario: Before: After: And here&#8217;s the step definition:]]></description>
			<content:encoded><![CDATA[<p></p><p>Using capybara&#8217;s standard <code>web steps.rb</code> often times isn&#8217;t very dry. For a scenario where a user completes a lengthy form, with text &#038; select fields as well as radio and check buttons, I refactored the code, leading to a much cleaner scenario:</p>
<p>Before:<br />
<script src="https://gist.github.com/1172059.js?file=create_profile_before.feature"></script></p>
<p>After:<br />
<script src="https://gist.github.com/1172059.js?file=create_profile_after.feature"></script></p>
<p>And here&#8217;s the step definition:<br />
<script src="https://gist.github.com/1172059.js?file=form_steps.rb"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://antonzolotov.com/2011/08/25/filling-out-text-select-radio-check-fields-with-capybara-and-cucumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading from Rails v.3.1.0rc4 v.3.1.0rc5 on Heroku</title>
		<link>http://antonzolotov.com/2011/08/03/upgrading-from-rails-v-3-1-0rc4-v-3-1-0rc5-on-heroku/</link>
		<comments>http://antonzolotov.com/2011/08/03/upgrading-from-rails-v-3-1-0rc4-v-3-1-0rc5-on-heroku/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 17:52:28 +0000</pubDate>
		<dc:creator>Anton Zolotov</dc:creator>
				<category><![CDATA[Heroku]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antonzolotov.com/?p=379</guid>
		<description><![CDATA[Getting Rails 3.1rc4 to run on Heroku&#8217;s Celadon Cedar Stack was no easy feat to begin with, mostly because the new asset pipeline is not well documented. After the rails 3.1 hackfest on July 14, a new release candidate came out. Unfortunately, merely updating rails broke things on Heroku. Here are the steps I took [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Getting Rails 3.1rc4 to run on Heroku&#8217;s Celadon Cedar Stack was no easy feat to begin with, mostly because the new asset pipeline is not well documented.</p>
<p>After the rails 3.1 hackfest on July 14, a new release candidate came out. Unfortunately, merely updating rails broke things on Heroku. Here are the steps I took to get it to work with the newest rc5:</p>
<p><strong>Upgrading an existing application from rc4</strong></p>
<ol>
<li>
		In your gemfile, change</p>
<pre>gem 'rails', '3.1.0.rc4'</pre>
<p>		to</p>
<pre>gem 'rails', '3.1.0.rc5'</pre>
</li>
<li>
		If you were using <code>therubyracer-heroku</code>, get rid of it.
	</li>
<li>
		Add <code>execjs</code> to your gemfile:</p>
<pre>gem 'execjs'</pre>
</li>
<li>
		Run <code>bundle update</code>
	</li>
<li>
		Adjust your <code>application.rb</code>. Change the line that reads</p>
<pre>-Bundler.require(:default, Rails.env) if defined?(Bundler)</pre>
<p>		to</p>
<pre>Bundler.require *Rails.groups(:assets) if defined?(Bundler)</pre>
</li>
<li>
		Edit your <code>production.rb</code>:</p>
<p>		If you have the line</p>
<pre>config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx</pre>
<p>		change it to</p>
<pre>config.action_dispatch.x_sendfile_header = nil</pre>
</li>
<li>
		<strong>Important!</strong> According to Heroku support, some older apps were having trouble with the javascript runtime, because of an incorrect path variable that is set when the application is created. To get around this, run</p>
<pre>heroku config:add PATH=vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin:bin</pre>
<p>		and restart the application</p>
<pre>heroku restart</pre>
</li>
</ol>
<p>The complete gemfile should look like this:</p>
<pre>
source 'http://rubygems.org'

gem 'rails', '3.1.0.rc5'
gem 'pg'

group :assets do
  gem 'coffee-script'
  gem 'uglifier'
  gem 'sass-rails'
end

# Asset template engines
gem 'json'
gem 'sass'
gem 'jquery-rails'

# heroku
group :production do
  gem 'thin'
  gem 'execjs'
end
</pre>
<p>If you&#8217;re still having issues, post it in the comments or ask the phenomenal Heroku support.</p>
]]></content:encoded>
			<wfw:commentRss>http://antonzolotov.com/2011/08/03/upgrading-from-rails-v-3-1-0rc4-v-3-1-0rc5-on-heroku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Secret to Learning How to Program is&#8230;</title>
		<link>http://antonzolotov.com/2009/12/06/the-secret-to-learning-how-to-program-is/</link>
		<comments>http://antonzolotov.com/2009/12/06/the-secret-to-learning-how-to-program-is/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 00:15:59 +0000</pubDate>
		<dc:creator>Anton Zolotov</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antonzolotov.com/?p=91</guid>
		<description><![CDATA[&#8230;  knowing where to look. This is not really a secret. The thing is that you won&#8217;t get anywhere if you don&#8217;t know your way around a system or programming language. Instead of trying to learn everything as you go along, buy a couple of books instead. For example, if you want to learn how [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>&#8230;  knowing where to look. This is not really a secret. The thing is that you won&#8217;t get anywhere if you don&#8217;t know your way around a system or programming language. Instead of trying to learn everything as you go along, buy a couple of books instead. For example, if you want to learn how to develop web apps with Ruby on Rails, get something on <a href="http://www.amazon.com/gp/product/0596516177?ie=UTF8&amp;tag=antozolo-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596516177">Ruby</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=antozolo-20&amp;l=as2&amp;o=1&amp;a=0596516177" border="0" alt="" width="1" height="1" />, <a href="http://www.amazon.com/gp/product/1934356166?ie=UTF8&amp;tag=antozolo-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1934356166">Rails</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=antozolo-20&amp;l=as2&amp;o=1&amp;a=1934356166" border="0" alt="" width="1" height="1" />, <a href="http://www.amazon.com/gp/product/0596101996?ie=UTF8&amp;tag=antozolo-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596101996">JavaScript</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=antozolo-20&amp;l=as2&amp;o=1&amp;a=0596101996" border="0" alt="" width="1" height="1" /> (affiliate links), and maybe Relational Databases. Read one book a week. Within a month, you&#8217;ll know where to look. And that&#8217;s all you need to know.</p>
]]></content:encoded>
			<wfw:commentRss>http://antonzolotov.com/2009/12/06/the-secret-to-learning-how-to-program-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assigning &#8220;first&#8221; and &#8220;last&#8221; to Blueprint CSS classes in Ruby on Rails</title>
		<link>http://antonzolotov.com/2009/12/05/assigning-first-and-last-to-blueprint-css-classes-with-rails/</link>
		<comments>http://antonzolotov.com/2009/12/05/assigning-first-and-last-to-blueprint-css-classes-with-rails/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 07:05:17 +0000</pubDate>
		<dc:creator>Anton Zolotov</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://antonzolotov.com/?p=75</guid>
		<description><![CDATA[I sometimes use the Blueprint CSS framework for development. The problem is that if you want to generate a grid using Blueprint or similar frameworks, you have to assign a class of &#8220;first&#8221; to the first element in each row, and a class of &#8220;last&#8221; to the last element in each row. This is a [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I sometimes use the Blueprint CSS framework for development. The problem is that if you want to generate a grid using Blueprint or similar frameworks, you have to assign a class of &#8220;first&#8221; to the first element in each row, and a class of &#8220;last&#8221; to the last element in each row.</p>
<p>This is a nice way to get the job done. It uses a helper method that returns &#8220;first&#8221; or &#8220;last&#8221; based on the index of the array with the elements, and the number of columns that is passed as an argument.</p>
<p><strong>Put this in your helper file</strong><br />
<script src="http://gist.github.com/250102.js?file=elements_helper.rb"></script> <strong>In your view, instead of writing</strong> <script src="http://gist.github.com/250102.js?file=gistfile2.rhtml"></script></p>
<p><strong>you write:</strong><br />
<script src="http://gist.github.com/250102.js?file=index.html.erb"></script></p>
<p>Let me know if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://antonzolotov.com/2009/12/05/assigning-first-and-last-to-blueprint-css-classes-with-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

