<?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; gems</title>
	<atom:link href="http://seanbehan.com/tag/gems/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>My First Ruby Gem: Hashed_Attributes</title>
		<link>http://seanbehan.com/ruby-gems/hashed_attributes/</link>
		<comments>http://seanbehan.com/ruby-gems/hashed_attributes/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 01:20:11 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Ruby Gems]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[hashed_attributes]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[rubgems.org]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1373</guid>
		<description><![CDATA[I just wrote and released my first Ruby Gem, Hashed Attributes https://rubygems.org/gems/hashed_attributes. It is a very simple ActiveRecord extension for saving variables through a serialized hash. The Gem will let you declare getter and setter methods that use a hash to store assigned data. For instance, instead of doing something like @user.preferences[:favorite_color] = 'orange' you [...]]]></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-gems%2Fhashed_attributes%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="My First Ruby Gem: Hashed_Attributes" data-url="http://seanbehan.com/ruby-gems/hashed_attributes/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I just wrote and released my first Ruby Gem, Hashed Attributes <a href="https://rubygems.org/gems/hashed_attributes">https://rubygems.org/gems/hashed_attributes</a>. It is a very simple ActiveRecord extension for saving variables through a serialized hash. The Gem will let you declare getter and setter methods that use a hash to store assigned data. For instance, instead of doing something like</p>
<pre class="wp-code-highlight prettyprint">@user.preferences[:favorite_color] = 'orange'</pre>
<p>you can do
<pre class="wp-code-highlight prettyprint">@user.favorite_color = 'orange'</pre>
<p>The value for favorite color will be kept in a serialized hash.</p>
<pre class="wp-code-highlight prettyprint">
  person = Person.new(:favorite_color=&gt;&quot;orange&quot;)
  {
               :id =&gt; nil,
      :preferences =&gt; {
          :favorite_color =&gt; &quot;orange&quot;,
      },
       :created_at =&gt; nil,
       :updated_at =&gt; nil
  }
</pre>
<p>Setup in the model is very straight forward. The first argument is the column name you want to use followed by a list of methods used as keys on the hash.</p>
<pre class="wp-code-highlight prettyprint">
# Example model
class Person &lt; ActiveRecord::Base
  hashed_attributes :preferences, :favorite_color, :theme, :plan # etc...
end
</pre>
<p>ActiveRecord is required to use this gem. Additionally, you need to add a column in your database.</p>
<pre class="wp-code-highlight prettyprint">
# Sample migration
create_table :people do |t|
   t.text :preferences
end
</pre>
<p>To install </p>
<pre class="wp-code-highlight prettyprint">
gem install hashed_attributes
</pre>
<p>Or place in your Rails Gemfile</p>
<pre class="wp-code-highlight prettyprint">
gem 'hashed_attributes'
</pre>
<p>The project code is hosted on Github: <a href="https://github.com/bseanvt/hashed_attributes">https://github.com/bseanvt/hashed_attributes</a> and <a href="https://rubygems.org/gems/hashed_attributes">https://rubygems.org/gems/hashed_attributes</a></p>
<p>Releasing this gem was a lot of fun and I&#8217;m looking forward to writing more gems!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby-gems/hashed_attributes/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>
		<item>
		<title>How to Install a Ruby Package without Ri or RDoc</title>
		<link>http://seanbehan.com/ruby/how-to-install-a-ruby-package-without-ri-or-rdoc/</link>
		<comments>http://seanbehan.com/ruby/how-to-install-a-ruby-package-without-ri-or-rdoc/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 17:43:09 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rdoc]]></category>
		<category><![CDATA[ri]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=616</guid>
		<description><![CDATA[gem install --no-rdoc --no-ri rails]]></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%2Fhow-to-install-a-ruby-package-without-ri-or-rdoc%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 Install a Ruby Package without Ri or RDoc" data-url="http://seanbehan.com/ruby/how-to-install-a-ruby-package-without-ri-or-rdoc/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><pre class="wp-code-highlight prettyprint">
gem install --no-rdoc --no-ri rails
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/ruby/how-to-install-a-ruby-package-without-ri-or-rdoc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Mail in Ruby with a Pony</title>
		<link>http://seanbehan.com/programming/send-mail-in-ruby-with-a-pony/</link>
		<comments>http://seanbehan.com/programming/send-mail-in-ruby-with-a-pony/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 16:33:22 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[pony]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=525</guid>
		<description><![CDATA[Great little gem that let&#8217;s you quickly and easily send out mail from your ruby scripts. gem install pony require 'rubygems' require 'pony' Pony.mail :from=&#62;&#34;me@example.com&#34;, :to=&#62;&#34;you@example.com&#34;, :subject=&#62;&#34;hello&#34;, :body=&#62;&#34;world&#34;]]></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%2Fprogramming%2Fsend-mail-in-ruby-with-a-pony%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="Send Mail in Ruby with a Pony" data-url="http://seanbehan.com/programming/send-mail-in-ruby-with-a-pony/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Great little gem that let&#8217;s you quickly and easily send out mail from your ruby scripts.</p>
<pre class="wp-code-highlight prettyprint">
gem install pony

require 'rubygems'
require 'pony'

Pony.mail :from=&gt;&quot;me@example.com&quot;, :to=&gt;&quot;you@example.com&quot;, :subject=&gt;&quot;hello&quot;, :body=&gt;&quot;world&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/send-mail-in-ruby-with-a-pony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install do_mysql Ruby Gem on Mac OS X</title>
		<link>http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/</link>
		<comments>http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 15:19:05 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[datamapper]]></category>
		<category><![CDATA[do_mysql]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=523</guid>
		<description><![CDATA[I ran into the same problem when installing mysql gem for Rails development. This fix worked for me http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/ The same thing works with the data objects gem. Just specify the path the mysql config that it&#8217;s using and the gem should install just fine. gem install do_mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config]]></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%2Fdatabases%2Finstall-do_mysql-ruby-gem-on-mac-os-x%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="Install do_mysql Ruby Gem on Mac OS X" data-url="http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I ran into the same problem when installing mysql gem for Rails development. This fix worked for me http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/</p>
<p>The same thing works with the data objects gem. Just specify the path the mysql config that it&#8217;s using and the gem should install just fine.</p>
<pre class="wp-code-highlight prettyprint">
gem install do_mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/databases/install-do_mysql-ruby-gem-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Monk on Ubuntu with Ruby Gems</title>
		<link>http://seanbehan.com/monk/installing-monk-on-ubuntu-with-ruby-gems/</link>
		<comments>http://seanbehan.com/monk/installing-monk-on-ubuntu-with-ruby-gems/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 01:24:30 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Monk]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=516</guid>
		<description><![CDATA[Installing monk like this will fail gem install monk You&#8217;ll need to install the wycats-thor gem first with this command gem install wycats-thor -s http://gems.github.com]]></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%2Fmonk%2Finstalling-monk-on-ubuntu-with-ruby-gems%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 Monk on Ubuntu with Ruby Gems" data-url="http://seanbehan.com/monk/installing-monk-on-ubuntu-with-ruby-gems/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Installing monk like this will fail</p>
<pre class="wp-code-highlight prettyprint">
gem install monk
</pre>
<p>You&#8217;ll need to install the wycats-thor gem first with this command</p>
<pre class="wp-code-highlight prettyprint">
gem install wycats-thor -s http://gems.github.com
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/monk/installing-monk-on-ubuntu-with-ruby-gems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing MySQL for Rails 2.2 Development on Mac OS X</title>
		<link>http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/</link>
		<comments>http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 16:35:50 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[adapter]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=421</guid>
		<description><![CDATA[Oh what trouble Rails 2.2 and MySQL (on Mac OS X) can be. Rails, as of version >= 2.2, no longer comes bundled with the MySQL adapter. This means you&#8217;ll need to install it yourself, but it appears that the gem for installing it is also broken. This will fail gem install mysql What you [...]]]></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%2Fprogramming%2Ffixing-mysql-for-rails-2-2-development-on-mac-os-x%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="Fixing MySQL for Rails 2.2 Development on Mac OS X" data-url="http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Oh what trouble Rails 2.2 and MySQL (on Mac OS X) can be. Rails, as of version >= 2.2, no longer comes bundled with the MySQL adapter. This means you&#8217;ll need to install it yourself, but it appears that the gem for installing it is also broken.</p>
<p>This will fail</p>
<pre class="wp-code-highlight prettyprint">
gem install mysql
</pre>
<p>What you need to do is tell the gem which MySQL to use. I installed MySQL with mac ports, http://macports.org , so I need to specify this when I run the installation command.</p>
<pre class="wp-code-highlight prettyprint">
gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
</pre>
<p>Check out an earlier post explaining how to install MySQL with mac ports http://seanbehan.com/programming/installing-sphinx-search-engine-on-mac-os-x-or-ld-library-not-found-for-lmysqlclient/</p>
<p>You&#8217;re not out of the woods yet. Rails needs to know the location of the socket it uses to connect to the MySQL server. I created a symbolic link to the location Rails normally looks for this socket. You could specify the location of the socket in the config/database.yml file, however, then you&#8217;ll need to do this with each of your applications.</p>
<pre class="wp-code-highlight prettyprint">
ln -s /private/tmp/mysql.sock /opt/local/var/run/mysql5/mysqld.sock
</pre>
<p>If there is an easier way to get MySQL back for Rails on Mac OS X please let me know. I&#8217;d love a quick fix to this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/fixing-mysql-for-rails-2-2-development-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

