<?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>Mindtonic &#187; rails</title>
	<atom:link href="http://blog.mindtonic.net/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mindtonic.net</link>
	<description>Thoughts on Music and Application Development</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:08:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing MySQL Gem after Installing MySQL From MacPorts</title>
		<link>http://blog.mindtonic.net/installing-mysql-gem-after-installing-mysql-from-macports/</link>
		<comments>http://blog.mindtonic.net/installing-mysql-gem-after-installing-mysql-from-macports/#comments</comments>
		<pubDate>Tue, 25 May 2010 20:25:54 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Gems]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=130</guid>
		<description><![CDATA[MacPorts is a fantastic resource for installing and managing libraries on OSX. When working with Ruby on Rails, I installed MySQL (and Postgresql) using MacPorts, but had trouble getting the MySQL gem to install and connect. The error message I received was: Error: uninitialized constant MysqlCompat::MysqlRes Here is the magic formula: sudo gem install -v [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://macports.org">MacPorts</a> is a fantastic resource for installing and managing libraries on OSX.  When working with Ruby on Rails, I installed MySQL (and Postgresql) using MacPorts, but had trouble getting the MySQL gem to install and connect.  The error message I received was:</p>
<p><code>Error: uninitialized constant MysqlCompat::MysqlRes</code></p>
<p>Here is the magic formula:<br />
<code><br />
sudo gem install -v 2.7 --no-rdoc --no-ri mysql --<br />
--with-mysql-dir=/opt/local/lib/mysql5<br />
--with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config;<br />
</code></p>
<p>Source: <a href="http://www.ruby-forum.com/topic/192550">http://www.ruby-forum.com/topic/192550</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/installing-mysql-gem-after-installing-mysql-from-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Better State Machine</title>
		<link>http://blog.mindtonic.net/a-better-state-machine/</link>
		<comments>http://blog.mindtonic.net/a-better-state-machine/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 13:33:35 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Rails Plugins]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[observers]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[state_machine]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=128</guid>
		<description><![CDATA[I have been using AASM as my default State Machine Rails plugin for quite some time. It has always worked great, but now there is a better, more thorough State Machine I recommend. state_machine 0.9 has just been released, and as you can read in this blog post, they are rapidly moving towards the finalization [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using AASM as my default State Machine Rails plugin for quite some time.  It has always worked great, but now there is a better, more thorough State Machine I recommend.  state_machine 0.9 has just been released, and as you can read in this blog post, they are rapidly moving towards the finalization of the 1.0 version.  <a href="http://www.pluginaweek.org/2010/04/19/state_machine-0-9-0-locked-and-loaded">http://www.pluginaweek.org/2010/04/19/state_machine-0-9-0-locked-and-loaded</a>!</p>
<p>What lead me to discover this fantastic plugin was the need to be able to call ActiveRecord observers in relation to the State of an object.  With AASM, I had to incorporate my lib class calls in a method that was referenced in a state definition.  I didn&#8217;t like this because it required my Model to have too much knowledge of the outside world.  I think it is a best practice to encapsulate this type of functionality into an observer, leaving the model to be happy in it&#8217;s own little world.  state_machine accomplishes this by allowing the placement of observer calls using a DSL provided by the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/a-better-state-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting attachment_fu to Paperclip</title>
		<link>http://blog.mindtonic.net/converting-attachment_fu-to-paperclip/</link>
		<comments>http://blog.mindtonic.net/converting-attachment_fu-to-paperclip/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 15:37:56 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Gems]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Paperclip]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=118</guid>
		<description><![CDATA[I am making the transition from attachment_fu to paperclip on a very large project of mine. I wrote the following method, inside of my old attachment_fu model ItemImage to do the work. I wrote it to run from inside the rails console. It gives handy messages out letting you know what happened. Reference: http://thewebfellas.com/blog/2008/11/2/goodbye-attachment_fu-hello-paperclip def [...]]]></description>
			<content:encoded><![CDATA[<p>I am making the transition from attachment_fu to <a href="http://github.com/thoughtbot/paperclip">paperclip</a> on a very large project of mine.  I wrote the following method, inside of my old attachment_fu model ItemImage to do the work.  I wrote it to run from inside the rails console.  It gives handy messages out letting you know what happened.</p>
<p>Reference: <a href="http://thewebfellas.com/blog/2008/11/2/goodbye-attachment_fu-hello-paperclip">http://thewebfellas.com/blog/2008/11/2/goodbye-attachment_fu-hello-paperclip</a></p>
<textarea cols="40" rows="10" name="code" class="Ruby">def self.convert_fu
  for item in Item.all
    # has an image
    if item.item_image
      # the image exists
      filename = "public" + item.item_image.public_filename
      if File::exists?(filename)
        image = File.open(filename)
        item.image = image
        item.save
        puts "#{item.name} Image Converted"
      else
        puts "====&gt; #{item.name} Image could not be found"
      end
    else
      puts "#{item.name} has no image"
    end
  end
end</textarea>
	<!-- WordPress Code Snippet -->
	<script type="text/javascript" src="http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/js/shCore.js"></script><script type="text/javascript" src="http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/js/shBrushRuby.js"></script>
	<link type="text/css" rel="stylesheet" href="http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/css/SyntaxHighlighter.css"/>
	
	<script language="javascript">
	dp.SyntaxHighlighter.ClipboardSwf = 'http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/js/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');
	</script>
	<!-- End WordPress Code Snippet -->
	]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/converting-attachment_fu-to-paperclip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Javascript and CSS Compression</title>
		<link>http://blog.mindtonic.net/rails-javascript-and-css-compression/</link>
		<comments>http://blog.mindtonic.net/rails-javascript-and-css-compression/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 17:19:19 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails Plugins]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=91</guid>
		<description><![CDATA[To speed up site loading, there are two great plugins for &#8220;compressing&#8221; your stylesheets and javascript. The first is bundle-fu. This plugin does not actually compress the files, but rather combines all of the individual documents into one before shipping it out to the client browser. $ script/plugin install git://github.com/timcharper/bundle-fu.git And then you simply wrap [...]]]></description>
			<content:encoded><![CDATA[<p>To speed up site loading, there are two great plugins for &#8220;compressing&#8221; your stylesheets and javascript.</p>
<p>The first is <a href="http://code.google.com/p/bundle-fu/">bundle-fu</a>.  This plugin does not actually compress the files, but rather combines all of the individual documents into one before shipping it out to the client browser.</p>
<p><code>$ script/plugin install git://github.com/timcharper/bundle-fu.git</code></p>
<p>And then you simply wrap your sheet and script calls in the bundle method:</p>
<pre>
  <% bundle do %>
    ...
    <%= javascript_include_tag "prototype" %>
    <%= stylesheet_link_tag "basic.css" %>
    <%= calendar_date_select_includes "red" %>
    <script src="javascripts/application.js" type="text/javascript"></script>
    ...
  <% end %>
</pre>
<p>The Second plugin, which actually does compress all of your files, is sbecker&#8217;s <a href="http://github.com/sbecker/asset_packager/tree/master">asset_packager</a>.  This one is a lot more involved, so check out the github site for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/rails-javascript-and-css-compression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Available Fields from FeedNormalizer Gem</title>
		<link>http://blog.mindtonic.net/available-fields-from-feednormalizer/</link>
		<comments>http://blog.mindtonic.net/available-fields-from-feednormalizer/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 18:18:52 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Gems]]></category>
		<category><![CDATA[feednormalizer]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=29</guid>
		<description><![CDATA[The FeedNormalizer Gem does an excellent job of returning a single unified object from many of several different syndicated feed types. This saves you from having to worry about whether you are dealing with an rss, atom or some other kind of feed. The following is a list of the available fields for both the [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://rubyforge.org/projects/feed-normalizer">FeedNormalizer</a> Gem does an excellent job of returning a single unified object from many of several different syndicated feed types.  This saves you from having to worry about whether you are dealing with an rss, atom or some other kind of feed.</p>
<p>The following is a list of the available fields for both the Feed object itself and the Entries objects associated as articles in the channel.</p>
<p><strong>FeedNormalizer::Feed</strong></p>
<ul>
<li>title</li>
<li>description</li>
<li>id</li>
<li>last_updated</li>
<li>copyright</li>
<li>authors / author</li>
<li>urls / url</li>
<li>image</li>
<li>generator</li>
<li>items / channel</li>
</ul>
<p><strong>FeedNormalizer::Entry</strong></p>
<ul>
<li>content</li>
<li>description</li>
<li>title</li>
<li>date_published</li>
<li>urls / url</li>
<li>id</li>
<li>authors / author</li>
<li>copyright</li>
<li>categories</li>
</ul>
<p><strong>Etags</strong></p>
<p>Etags and last_modified are crucial elements to sending proper request headers if you hope to receive conditional get responses and save yourself some overhead in feed processing.  FeedNormalizer does not provide access to these elements as they are actually part of the http response headers, and not the feed itself.</p>
<p>While heavily studying the art of feed processing, I encountered <a href="http://github.com/pauldix/feedzirra/tree/master">Feezirra</a> and <a href="http://github.com/jsl/feedtosis/tree">Feedtosis</a>, both excellent libraries for feed processing.  My own application required a modified version of their concept, but there was a lot to learn in their code.</p>
<p><a href="http://github.com/jsl/feedtosis/tree">Feedtosis</a> uses the HttpHeaders process to collect this information from a <a href="http://curb.rubyforge.org/classes/Curl/Easy.html">Curl::Easy</a> object.  I adapted the <a href="http://github.com/jsl/feedtosis/tree">Feedtosis</a> code to meet my needs like this:</p>
<pre>
require 'http_headers'

class Feed < ActiveRecord::Base
  def store_header_information
    headers = HttpHeaders.new(curl.header_str)
    self.response_code = curl.response_code
    self.etag = headers.etag unless headers.etag.nil?
    self.last_modified = headers.last_modified unless headers.last_modified.nil?
  end
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/available-fields-from-feednormalizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shoulda Testing With Ultrasphinx</title>
		<link>http://blog.mindtonic.net/shoulda-testing-with-ultrasphinx/</link>
		<comments>http://blog.mindtonic.net/shoulda-testing-with-ultrasphinx/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 19:38:36 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Rails Plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[shoulda]]></category>
		<category><![CDATA[sphinx]]></category>
		<category><![CDATA[ultrasphinx]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=6</guid>
		<description><![CDATA[I use the Shoulda testing framework for my Rails applications. After installing and beginning to use the Ultrasphinx plugin, I needed to figure out how to configure and run in a testing environment. This blog entry held the answer: Stephen Celis: Testing with Ultrasphinx]]></description>
			<content:encoded><![CDATA[<p>I use the <a href="http://thoughtbot.com/projects/shoulda/">Shoulda</a> testing framework for my Rails applications.  After installing and beginning to use the <a href="http://github.com/fauna/ultrasphinx/tree/master">Ultrasphinx plugin</a>, I needed to figure out how to configure and run in a testing environment.  This blog entry held the answer: <a href="http://stephencelis.com/archive/2008/4/testing-with-ultrasphinx/">Stephen Celis: Testing with Ultrasphinx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/shoulda-testing-with-ultrasphinx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ultrasphinx MySql Location Error</title>
		<link>http://blog.mindtonic.net/ultrasphinx-mysql-location-error/</link>
		<comments>http://blog.mindtonic.net/ultrasphinx-mysql-location-error/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 18:44:00 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Rails Plugins]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sphinx]]></category>
		<category><![CDATA[ultrasphinx]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=3</guid>
		<description><![CDATA[After installing all of the necessary elements for Spinx and Ultrasphinx, I began following the instructions from Snax Fauna to get the system up and running. rake ultrasphinx:configure worked fine, but I encountered the following error upon attempting to index my models: rake ultrasphinx:index ... dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib Referenced from: /usr/local/bin/indexer Reason: image [...]]]></description>
			<content:encoded><![CDATA[<p>After installing all of the necessary elements for <a href="http://www.sphinxsearch.com/">Spinx</a> and <a href="http://github.com/fauna/ultrasphinx/tree/master">Ultrasphinx</a>, I began following the instructions from <a href="http://github.com/fauna">Snax Fauna</a> to get the system up and running.</p>
<p><code>rake ultrasphinx:configure</code></p>
<p>worked fine, but I encountered the following error upon attempting to index my models:</p>
<p><code>rake ultrasphinx:index<br />
...<br />
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib<br />
Referenced from: /usr/local/bin/indexer<br />
Reason: image not found</code></p>
<p>In my configuration for development, I use the MAMP MySql server.  The rake configure command correctly pulled all of the connection information from database.yml, so that was not the problem.</p>
<p>I searched around and finally encountered this solution from <a href="http://blog.mhartl.com/2008/07/17/searching-a-ruby-on-rails-application-with-sphinx-and-ultrasphinx/">Michael Hartl</a>:</p>
<p><code>$ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql</code></p>
<p>It worked brilliantly.  Thanks Michael.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/ultrasphinx-mysql-location-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
