<?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>Sean&#039;s Blog &#187; Rails</title>
	<atom:link href="http://seanbehan.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +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>How to Add Additional Sub Directories to the Default Rails Test:Unit File Structure</title>
		<link>http://seanbehan.com/ruby-on-rails/how-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure/</link>
		<comments>http://seanbehan.com/ruby-on-rails/how-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 21:44:54 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[sub directories]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1496</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Fhow-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="How to Add Additional Sub Directories to the Default Rails Test:Unit File Structure" data-url="http://seanbehan.com/ruby-on-rails/how-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p><script src="https://gist.github.com/1635859.js"> </script></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/how-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transform Matching Text with Gsub in Ruby and Regular Expression</title>
		<link>http://seanbehan.com/ruby/transform-matching-text-with-gsub-in-ruby-and-regular-expression/</link>
		<comments>http://seanbehan.com/ruby/transform-matching-text-with-gsub-in-ruby-and-regular-expression/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 21:31:58 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[gsub]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1489</guid>
		<description><![CDATA[Here is a gist that demonstrates how easy it is to transform text using #gsub and a block with Ruby. For more helpful string extensions in Ruby check out our Ruby Gem on GitHub https://github.com/AgilionApps/rails_extensions]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby%2Ftransform-matching-text-with-gsub-in-ruby-and-regular-expression%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Transform Matching Text with Gsub in Ruby and Regular Expression" data-url="http://seanbehan.com/ruby/transform-matching-text-with-gsub-in-ruby-and-regular-expression/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Here is a gist that demonstrates how easy it is to transform text using #gsub and a block with Ruby.</p>
<p><script src="https://gist.github.com/1591261.js?file=gsub.rb"></script></p>
<p>For more helpful string extensions in Ruby check out our Ruby Gem on GitHub <a href="https://github.com/AgilionApps/rails_extensions">https://github.com/AgilionApps/rails_extensions</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby/transform-matching-text-with-gsub-in-ruby-and-regular-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Send_File in Production Delivers an Empty File</title>
		<link>http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/</link>
		<comments>http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 15:54:06 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[gotchas]]></category>
		<category><![CDATA[mishaps]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[send_file]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1370</guid>
		<description><![CDATA[If you&#8217;re running Rails in production it will by default be configured to let apache or nginx send files for you. If you&#8217;re handling file downloads yourself with send_file send_file(&#34;path/to/file.txt&#34;) you will notice that the downloaded files are empty. To get around this just comment out the following in your config/environments/production.rb file. # comment out [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Frails-send_file-in-production-delivers-an-empty-file%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Rails Send_File in Production Delivers an Empty File" data-url="http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>If you&#8217;re running Rails in production it will by default be configured to let apache or nginx send files for you. If you&#8217;re handling file downloads yourself with send_file</p>
<pre class="wp-code-highlight prettyprint">
send_file(&quot;path/to/file.txt&quot;)
</pre>
<p>you will notice that the downloaded files are empty. To get around this just comment out the following in your config/environments/production.rb file.</p>
<pre class="wp-code-highlight prettyprint">
  # comment out for production because apache/nginx are not doing this for us
  #config.action_dispatch.x_sendfile_header = &quot;X-Sendfile&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/rails-send_file-in-production-delivers-an-empty-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple String Concatenation of a Collection Written as a Helper for Rails</title>
		<link>http://seanbehan.com/ruby-on-rails/simple-string-concatenation-of-a-collection-written-as-a-helper-for-rails/</link>
		<comments>http://seanbehan.com/ruby-on-rails/simple-string-concatenation-of-a-collection-written-as-a-helper-for-rails/#comments</comments>
		<pubDate>Tue, 24 May 2011 02:23:17 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[buffer]]></category>
		<category><![CDATA[collection]]></category>
		<category><![CDATA[content_tag]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[helper methods]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[visual markup]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1316</guid>
		<description><![CDATA[At Railsconf last week I took Greg Pollack&#8217;s online course Rails Best Practices. The interface is gorgeous and the instructions are excellent. One of the lessons involved taking a partial and moving it into a helper. I was reminded how difficult such a simple task can be. I have written about this before Yield a [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Fsimple-string-concatenation-of-a-collection-written-as-a-helper-for-rails%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Simple String Concatenation of a Collection Written as a Helper for Rails" data-url="http://seanbehan.com/ruby-on-rails/simple-string-concatenation-of-a-collection-written-as-a-helper-for-rails/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>At Railsconf last week I took Greg Pollack&#8217;s online course <a href="http://www.codeschool.com/courses/rails-best-practices">Rails Best Practices</a>. The interface is gorgeous and the instructions are excellent. One of the lessons involved taking a partial and moving it into a helper. I was reminded how difficult such a simple task can be. I have written about this before <a href="http://seanbehan.com/programming/yield-a-block-within-rails-helper-method-with-multiple-content_tags-using-concat/">Yield a Block Within Rails Helper Method with Multiple Content Tags</a>. However, that post aims to solve a slightly different problem, where the helper method takes the captured text from a block passed as an argument which essentially acts as a wrapper.  </p>
<p>The difficulty isn&#8217;t with the logic itself and or the complexity/verbosity that the code is likely to produce. Rather, it is difficult because you have to endlessly concatenate strings and this something somewhat uncommon when programming with ruby. We have to remember that we&#8217;re working with a buffer of text about to be flushed. Here is a simple code snippet that shows how to write a helper method that loops over a collection of objects. </p>
<pre class="wp-code-highlight prettyprint">
  def bookmarks_for(user=nil)
    content_tag(:div, :id =&gt; &quot;bookmarks&quot;) do
      user.bookmarks.each do |bookmark|
        concat(
          content_tag(:strong) { bookmark.member_name } +
          excerpt(bookmark.body, '', 100)
        )
      end.join
    end
  end
</pre>
<p>Notice the use of the concat() method the &#8220;+&#8221; sugb and .join() method. All three of which bring these statements together into one final piece of html called in the view. </p>
<pre class="wp-code-highlight prettyprint">
&lt;%= bookmarks_for(@user) %&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/simple-string-concatenation-of-a-collection-written-as-a-helper-for-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Ruby on Rails 3, MySQL, Git, Ruby Enterprise Edition, Passenger (Mod_Rails) on Ubuntu with Rackspace Cloud.</title>
		<link>http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/</link>
		<comments>http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 19:12:46 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby enterprise edition]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1269</guid>
		<description><![CDATA[Short and sweet. Here all the commands I run in this order to set up a brand new box. It usually takes about 10 &#8211; 15 minutes on a 256 MB RAM instance. Compiling Ruby Enterprise Edition, which is super easy, will take the most amount of time. It will seem to have gotten stuck. [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Finstalling-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Installing Ruby on Rails 3, MySQL, Git, Ruby Enterprise Edition, Passenger (Mod_Rails) on Ubuntu with Rackspace Cloud." data-url="http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Short and sweet. Here all the commands I run in this order to set up a brand new box. It usually takes about 10 &#8211; 15 minutes on a 256 MB RAM instance. Compiling Ruby Enterprise Edition, which is super easy, will take the most amount of time. It will seem to have gotten stuck. It hasn&#8217;t. It just takes a little while. </p>
<pre class="wp-code-highlight prettyprint">
# Update, upgrade and install all necessary packages for Ruby on Rails server if you've got a fresh Ubuntu slice
apt-get update
apt-get upgrade

apt-get install build-essential patch libssl-dev libreadline5-dev

apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby imagemagick librmagick-ruby1.8 librmagick-ruby-doc libfreetype6-dev xml-core postfix
# postfix will prompt you for details
# use Internet Site and enter in the domain name you are planning on sending email from 

apt-get install apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev libcurl4-openssl-dev git-core mysql-server mysql-client libmysqlclient15-dev libmysql-ruby
# mysql will also prompt you to set up a root user account. set the password to be anything you like

# next, download the latest release of ruby enterprise edition but when you're installing it on your own machine version numbers and release dates may have changed.
# pay attention to the version and release date before the file extension. it will be something like
# ... 1.8.7-2010.02
# this will change to something like 2011.03, 2011.04... etc in the future.
# just double check the paths on when you are installing and make the necessary substitutions

# ruby enterprise edition is available at http://www.rubyenterpriseedition.com/download.html
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz 

./ruby-enterprise-1.8.7-2010.02/installer
# this may take a little while (just follow the instructions)
# and hit enter to install in default location (recommended) when prompted 

# and to install passenger (which is mod_rails for apache)
/opt/ruby-enterprise-1.8.7-2010.02/bin/passenger-install-apache2-module 

# i take the output from the above script and add it to my available modules directory
vim /etc/apache2/mods-available/passenger.conf

# and enter something like this in the newly created file (your version numbers will prob. be different)
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2
PassengerRuby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby

# and then sym link it to the enabled directory so that apache knows about it
ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf

# and now i want to include ruby enterprise edition in my path so i add it to my profile (again make sure the path is correct)
vim /etc/profile.d/passenger.sh
export PATH=/opt/ruby-enterprise-1.8.7-2010.02/bin:$PATH

. /etc/profile.d/passenger.sh
# the &quot;.&quot; file will make the setting available for the current terminal session
rails -v
ruby -v
rake -v
# should all be working now
# and
which ruby
# should point to the ruby enterprise edition under /opt

# next i
# set up public/private keys
# so i can do
# ssh localhost without using a password
cd
test -e ~/.ssh/id_dsa.pub || ssh-keygen -t dsa
cat ~/.ssh/id_dsa.pub &gt;&gt; ~/.ssh/authorized_keys2

# and finally install git
apt-get install git-core
</pre>
<p>You should now have a server ready to server ruby on rails applications!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/installing-ruby-on-rails-3-mysql-git-ruby-enterprise-edition-passenger-mod_rails-on-ubuntu-with-rackspace-cloud/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rails 3 disable_with Does Not Work with Ajax Remote Form_for</title>
		<link>http://seanbehan.com/front-end-development/rails-3-disable_with-does-not-work-with-ajax-remote-form_for/</link>
		<comments>http://seanbehan.com/front-end-development/rails-3-disable_with-does-not-work-with-ajax-remote-form_for/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 17:40:50 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[disable_with]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[rails helpers]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1267</guid>
		<description><![CDATA[It appears that the :disable_with option on the submit_tag form helper method does not behave as expected with remote forms. I&#8217;m not sure if this is a bug or not. But the fix is pretty straight forward, but perhaps a little difficult to trouble shoot. Using submit_tag inside a remote form &#38;lt;%= submit_tag &#34;Submit&#34;, :disable_with [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Ffront-end-development%2Frails-3-disable_with-does-not-work-with-ajax-remote-form_for%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Rails 3 disable_with Does Not Work with Ajax Remote Form_for" data-url="http://seanbehan.com/front-end-development/rails-3-disable_with-does-not-work-with-ajax-remote-form_for/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>It appears that the :disable_with option on the submit_tag form helper method does not behave as expected with remote forms. I&#8217;m not sure if this is a bug or not. But the fix is pretty straight forward, but perhaps a little difficult to trouble shoot. Using submit_tag inside a remote form</p>
<pre class="wp-code-highlight prettyprint">
&amp;lt;%= submit_tag &quot;Submit&quot;, :disable_with =&amp;gt; &quot;Submitting....&quot; %&amp;gt;
</pre>
<p>Will not work.</p>
<p>You have to edit your public/javascripts/rails.js file around line #167</p>
<p>and change</p>
<pre class="wp-code-highlight prettyprint">document.on(&quot;ajax:after&quot;, &quot;form&quot;, function(event, element) {</pre>
<p>to</p>
<pre class="wp-code-highlight prettyprint">document.on(&quot;ajax:complete&quot;, &quot;form&quot;, function(event, element) {</pre>
<p>Then things will behave as expected. This assumes you are using Prototype (rather than jQuery).</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/front-end-development/rails-3-disable_with-does-not-work-with-ajax-remote-form_for/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails Select Tag and Onchange Event Calling a Remote Function with Default Option Selected</title>
		<link>http://seanbehan.com/ruby-on-rails/rails-select-tag-and-onchange-event-calling-a-remote-function-with-default-option-selected/</link>
		<comments>http://seanbehan.com/ruby-on-rails/rails-select-tag-and-onchange-event-calling-a-remote-function-with-default-option-selected/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 19:33:11 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[defaults]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[options_for_select]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[select_tag]]></category>
		<category><![CDATA[to_sym]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1215</guid>
		<description><![CDATA[Here is a little code snippet that will fire off a request to update_client_path when you change the select field. This stands alone, rather than being apart of a larger form. The Client::CATEGORY argument is a hash, which I populated manually in my Client.rb model. It is something like this CATEGORY = {:lead =&#62; &#34;Prospective [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fruby-on-rails%2Frails-select-tag-and-onchange-event-calling-a-remote-function-with-default-option-selected%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Rails Select Tag and Onchange Event Calling a Remote Function with Default Option Selected" data-url="http://seanbehan.com/ruby-on-rails/rails-select-tag-and-onchange-event-calling-a-remote-function-with-default-option-selected/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Here is a little code snippet that will fire off a request to update_client_path when you change the select field. This stands alone, rather than being apart of a larger form. The Client::CATEGORY argument is a hash, which I populated manually in my Client.rb model. It is something like this </p>
<pre class="wp-code-highlight prettyprint">
CATEGORY = {:lead =&gt; &quot;Prospective clients&quot;, :past =&gt; &quot;Previous clients...&quot;}
</pre>
<p>In my view I have </p>
<pre class="wp-code-highlight prettyprint">
&amp;lt;%= select_tag &quot;client_category&quot;,
 options_for_select(Client::CATEGORY.keys, @client.category.to_sym),
 { :onchange =&amp;gt; remote_function( :url =&amp;gt; update_client_path(@client), :with=&amp;gt;&quot;'change_to='+this.value+''&quot; ) } %&amp;gt;
</pre>
<p>One gotcha is that the select_tag, options_for_select argument expects a symbol if you&#8217;re passing in a hash as the type of the collection! It may not set the default if you provide it with a string for the second arg (which specifies which option should be set as selected). </p>
<p>You also need to make sure that the url update_client_path is set in your routes file and that your controller (clients_controller in this case) has the appropriate method to handle the request. </p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-on-rails/rails-select-tag-and-onchange-event-calling-a-remote-function-with-default-option-selected/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems &gt;= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org</title>
		<link>http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/</link>
		<comments>http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 14:00:21 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[irb]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby enterprise edition]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1211</guid>
		<description><![CDATA[After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time ./script/console production # =&#62; Loading production environment (Rails 2.3.5) Rails requires RubyGems &#62;= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org You then scratch your head and run which gem which [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Flinux%2Fruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org" data-url="http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time</p>
<pre class="wp-code-highlight prettyprint">
./script/console production
# =&gt;
Loading production environment (Rails 2.3.5)
Rails requires RubyGems &gt;= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
</pre>
<p>You then scratch your head and run </p>
<pre class="wp-code-highlight prettyprint">
which gem
which ruby
which rails
</pre>
<p>to find that all appears to be in order. You have rubygems installed , ruby is installed and so is rails. You also find that each are pointing to the correct location, which is something like /usr/bin/gem -> /opt/ruby-enterprise-x.x.x.x/bin/gem, where x.x.x.x is the version of REE. </p>
<p>The problem isn&#8217;t however, with any of the above. The issue is with the location of irb. If you installed (like me) irb with apt-get install irb, then irb isn&#8217;t aware of your shiny new REE and ruby gems. It&#8217;s a simple fix however, unlink irb and symlink the /usr/bin/irb to REE&#8217;s irb like so&#8230;  </p>
<pre class="wp-code-highlight prettyprint">
rm /usr/bin/irb
</pre>
<p>And symlink it to the irb that REE has in bin </p>
<pre class="wp-code-highlight prettyprint">
ln -s /opt/ruby-enterprise-x.x.x.x/bin/irb /usr/bin/irb
</pre>
<p>Now cd into your rails app and run </p>
<pre class="wp-code-highlight prettyprint">
./script/console production
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/linux/ruby-enterprise-edition-and-passenger-scriptconsole-production-fails-and-instead-returns-loading-production-environment-rails-2-3-5-rails-requires-rubygems-1-3-2-please-install-rubygems-and-t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Beautiful is Ruby?</title>
		<link>http://seanbehan.com/posts/how-beautiful-is-ruby/</link>
		<comments>http://seanbehan.com/posts/how-beautiful-is-ruby/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 17:59:58 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[beauty in code]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1119</guid>
		<description><![CDATA[Working with Ruby and in particular Rails, it&#8217;s easy to take the beauty inherent in the language for granted. I mean look at this code. If you read it aloud to yourself, it reads like an english sentence that any non programmer can understand. Forum.categories.map do &#124;category&#124; link_to category.name, category end.to_sentence Forum categories map do [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fposts%2Fhow-beautiful-is-ruby%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="How Beautiful is Ruby?" data-url="http://seanbehan.com/posts/how-beautiful-is-ruby/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Working with Ruby and in particular Rails, it&#8217;s easy to take the beauty inherent in the language for granted. I mean look at this code. If you read it aloud to yourself, it reads like an english sentence that any non programmer can understand.</p>
<pre class="wp-code-highlight prettyprint">
Forum.categories.map do |category|
  link_to category.name, category
end.to_sentence
</pre>
<p>Forum categories map do category, link to category name, the category, end and convert to a sentence.  The code returns a an english sentence as well. </p>
<p>Fish, French Bread, Coffee and Hamburgers with each linked to the correct resource as well! </p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/posts/how-beautiful-is-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying to Dreamhost</title>
		<link>http://seanbehan.com/posts/deploying-to-dreamhost/</link>
		<comments>http://seanbehan.com/posts/deploying-to-dreamhost/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 15:43:24 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[freeze]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[unpack]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1115</guid>
		<description><![CDATA[Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use &#8220;localhost&#8221; which is typically the default setting when using the mysql adapter and developing locally or even on a small site. At least for me, when I ported a Rails app to Dreamhost, this was the [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fposts%2Fdeploying-to-dreamhost%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Deploying to Dreamhost" data-url="http://seanbehan.com/posts/deploying-to-dreamhost/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use &#8220;localhost&#8221; which is typically the default setting when using the mysql adapter and developing locally or even on a small site. </p>
<p>At least for me, when I ported a Rails app to Dreamhost, this was the only &#8220;Gotcha&#8221;, because my log files were not reporting any errors and were instead serving the 500 something went wrong file.<br />
A sample config/database.yml file</p>
<pre class="wp-code-highlight prettyprint">
production:
  adapter: mysql
  username: youruser
  password: yourpasswd
  database: ror_production_db
  host: mysql.yourdomain.com
</pre>
<p>To port, I unpack my gems, if I haven&#8217;t already</p>
<pre class="wp-code-highlight prettyprint">
rake gems:unpack
</pre>
<p>Then I freeze and package rails w/ my app just in case versions aren&#8217;t exact</p>
<pre class="wp-code-highlight prettyprint">
rake rails:freeze:gems
</pre>
<p>Then I upload to Dreamhost!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/posts/deploying-to-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

