<?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>Yan Pritzker &#187; RubyOnRails</title>
	<atom:link href="http://yanpritzker.com/category/rubyonrails/feed/" rel="self" type="application/rss+xml" />
	<link>http://yanpritzker.com</link>
	<description>photographer, entrepreneur, software engineer, musician, skier</description>
	<lastBuildDate>Thu, 26 Apr 2012 18:11:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel="next" href="http://yanpritzker.com/category/rubyonrails/feed/?page=2" />

		<item>
		<title>Rails plugin: view a tree of all your partials</title>
		<link>http://yanpritzker.com/2011/11/21/rails-view-a-tree-of-all-your-partials/</link>
		<comments>http://yanpritzker.com/2011/11/21/rails-view-a-tree-of-all-your-partials/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 15:48:28 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://yanpritzker.com/?p=372</guid>
		<description><![CDATA[Trying to refactor your views? Too many partials got you down? Let PartialMap help! Draws an ascii or html tree of all your views and the partials that they reference. The tool is very simple and has a plugin formatter architecture so you can create formatters for other views. Please fork and contribute, or just [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to refactor your views? Too many partials got you down? Let PartialMap help! Draws an ascii or html tree of all your views and the partials that they reference. The tool is very simple and has a plugin formatter architecture so you can create formatters for other views. Please fork and contribute, or just enjoy as is: <a href="https://github.com/skwp/PartialMap">PartialMap on github</a>.</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2011/11/21/rails-view-a-tree-of-all-your-partials/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2011/11/21/rails-view-a-tree-of-all-your-partials/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails Tips: Make fixtures play nice with acts_as_paranoid</title>
		<link>http://yanpritzker.com/2008/07/30/rails-tips-make-fixtures-play-nice-with-acts_as_paranoid/</link>
		<comments>http://yanpritzker.com/2008/07/30/rails-tips-make-fixtures-play-nice-with-acts_as_paranoid/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 15:47:52 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://skwpspace.com/?p=182</guid>
		<description><![CDATA[I was trying to write a test involving deleted items on a project using acts_as_paranoid (which marks objects with a deleted_at date instead of actually deleting them). When I created a fixture with a deleted_at date set, it turns out that making the fixture retrieval call items(:deleted_item) would fail because internally the fixtures use a [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to write a test involving deleted items on a project using acts_as_paranoid (which marks objects with a deleted_at date instead of actually deleting them). When I created a fixture with a deleted_at date set, it turns out that making the fixture retrieval call <code>items(:deleted_item)</code> would fail because internally the fixtures use a <code>find</code>, which then fails to find the deleted item. Here&#8217;s a workaround that extends the Fixtures class to do the right thing: </p>
<p><a href="http://gist.github.com/3277">acts_as_paranoid_fixtures.rb on gist.github.com</a></p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2008/07/30/rails-tips-make-fixtures-play-nice-with-acts_as_paranoid/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/07/30/rails-tips-make-fixtures-play-nice-with-acts_as_paranoid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging technique for Rails: decode the session cookie</title>
		<link>http://yanpritzker.com/2008/07/16/debugging-technique-for-rails-decode-the-session-cookie/</link>
		<comments>http://yanpritzker.com/2008/07/16/debugging-technique-for-rails-decode-the-session-cookie/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 19:17:04 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://skwpspace.com/?p=178</guid>
		<description><![CDATA[Ever try to debug a problem and needed to see what was inside the user&#8217;s session at the time? If you&#8217;re using the cookie session store (Rails 2.x), you can now use this tool to take a look: http://pastie.org/235017 Simply invoke it like this: DebugTools.show_session("your long session id goes in here") The code deals with [...]]]></description>
			<content:encoded><![CDATA[<p>Ever try to debug a problem and needed to see what was inside the user&#8217;s session at the time? If you&#8217;re using the cookie session store (Rails 2.x), you can now use this tool to take a look:</p>
<p><a href="http://pastie.org/235017">http://pastie.org/235017</a></p>
<p>Simply invoke it like this:<br/><br />
 <code>DebugTools.show_session("your long session id goes in here")</code></p>
<p>The code deals with linebreaks automatically, so don&#8217;t worry about formatting the string, just cut, paste and enjoy.</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2008/07/16/debugging-technique-for-rails-decode-the-session-cookie/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/07/16/debugging-technique-for-rails-decode-the-session-cookie/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Testing your ActiveRecord migrations</title>
		<link>http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/</link>
		<comments>http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 17:00:11 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[RubyOnRails]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://skwpspace.com/?p=164</guid>
		<description><![CDATA[Sometimes you have a data migration that creates or modifies records in some way, and you would like to test it in your unit tests right? Except that Rails typically just clones the structure of your dev database, not its data. So how do you test that a migration succeeded? Simple, just invoke it during [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you have a data migration that creates or modifies records in some way, and you would like to test it in your unit tests right? Except that Rails typically just clones the structure of your dev database, not its data. So how do you test that a migration succeeded? Simple, just invoke it during your test:</p>
<p>This code is written using the <a href="http://www.thoughtbot.com/projects/shoulda">shoulda</a> plugin which gives a slightly more verbose breakdown of the setup and the test, but it can be done with test/unit just as well.</p>
<pre><code>
context "orphan user migration" do
  setup do
    require "#{RAILS_ROOT}/db/migrate/163_create_orphan_owner"
    CreateOrphanOwner.up
  end
  should "create the orphan user" do
    assert orphan = User.orphan_owner
    assert orphan.role?(User::ORPHAN_OWNER)
  end
end
</code></pre>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>validates_acceptance_of behavior in Rails 2.0</title>
		<link>http://yanpritzker.com/2008/02/21/validates_acceptance_of-behavior-in-rails-20/</link>
		<comments>http://yanpritzker.com/2008/02/21/validates_acceptance_of-behavior-in-rails-20/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 18:30:51 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2008/02/21/validates_acceptance_of-behavior-in-rails-20/</guid>
		<description><![CDATA[I noticed that when upgrading to Rails 2.0, my validates_acceptance_of started failing (or rather, it started telling me that my field was not accepted when the param being passed was &#8217;1&#8242;). Apparently I had to add the :accept => true to make it work. I discovered this by reading the Rails source, where it mentions [...]]]></description>
			<content:encoded><![CDATA[<p>I noticed that when upgrading to Rails 2.0, my validates_acceptance_of started failing (or rather, it started telling me that my field was not accepted when the param being passed was &#8217;1&#8242;). Apparently I had to add the <code>:accept => true</code> to make it work. I discovered this by reading the Rails source, where it mentions that database columns will be converted to true/false so you must have this if you&#8217;re validating on a real database column</p>
<p><code><br />
validates_acceptance_of   :terms_of_service, :allow_nil => false, :accept => true<br />
</code></p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2008/02/21/validates_acceptance_of-behavior-in-rails-20/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/02/21/validates_acceptance_of-behavior-in-rails-20/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>acts_as_versioned for a set of columns</title>
		<link>http://yanpritzker.com/2007/10/30/acts_as_versioned-for-a-set-of-columns/</link>
		<comments>http://yanpritzker.com/2007/10/30/acts_as_versioned-for-a-set-of-columns/#comments</comments>
		<pubDate>Tue, 30 Oct 2007 03:12:13 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2007/10/30/acts_as_versioned-for-a-set-of-columns/</guid>
		<description><![CDATA[acts_as_versioned is a great plugin for versioning a set of model attributes transparently every time you save. The plugin seems to be built with exclusion in mind (version all except these) but to get it to work only on a specific set of columns, this simple trick can be applied: class Foo [:description_t] def versioned_attributes; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://agilewebdevelopment.com/plugins/acts_as_versioned">acts_as_versioned</a> is a great plugin for versioning a set of model attributes transparently every time you save. The plugin seems to be built with exclusion in mind (<em>version all except these</em>) but to get it to work only on a specific set of columns, this simple trick can be applied:</p>
<pre class="textmate-source black_pearl"><span class="source source_ruby source_ruby_rails"><span class="meta meta_rails meta_rails_model"><span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Foo<span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_ruby"> <span class="punctuation punctuation_separator punctuation_separator_inheritance punctuation_separator_inheritance_ruby"><</span> ActiveRecord::Base</span></span></span>
  acts_as_versioned <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>if_changed</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=></span> <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>description_t</span><span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span>
  <span class="meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">versioned_attributes</span></span><span class="punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby">;</span> <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>description_t</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>planspace_updated_by_id</span><span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span><span class="punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby">;</span> <span class="keyword keyword_control keyword_control_ruby">end</span>
</span><span class="keyword keyword_control keyword_control_ruby">end</span>
</span></pre>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2007/10/30/acts_as_versioned-for-a-set-of-columns/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2007/10/30/acts_as_versioned-for-a-set-of-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clean svn tag support for Capistrano 2</title>
		<link>http://yanpritzker.com/2007/09/11/clean-svn-tag-support-for-capistrano-2/</link>
		<comments>http://yanpritzker.com/2007/09/11/clean-svn-tag-support-for-capistrano-2/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 19:36:13 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2007/09/11/clean-svn-tag-support-for-capistrano-2/</guid>
		<description><![CDATA[If you find capistrano&#8217;s release directory naming conventions hard to use, a great alternative is to base releases on your svn tags. It turns out that implementing this in cap2 is quite simple. Unfortunately I can&#8217;t quite figure out how to turn this into a library so at this point it exists as a cut-n-paste [...]]]></description>
			<content:encoded><![CDATA[<p>If you find capistrano&#8217;s release directory naming conventions hard to use, a great alternative is to base releases on your svn tags. It turns out that implementing this in cap2 is quite simple. Unfortunately I can&#8217;t quite figure out how to turn this into a library so at this point it exists as a cut-n-paste release. Looking for a brave soul to spend a bit more time to turn this into perhaps a deployment recipe.</p>
<p>By reading capistrano source I was able to ferret out the places where I had to make minor adjustments, leading to an implementation in roughly 10 lines of code. All I really had to change was how capistrano sorts releases (using the modification date rather than the name of the directory), and how it determine which revision to write to the REVISION file (by making it grep for the proper field in the svn output). The release name itself and repository location was set using the standard capistrano variable based on the TAG passed in from command line.</p>
<p>The pastie is here <a href="http://pastie.caboo.se/pastes/96197">capistrano 2 svn tag support</a>.</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2007/09/11/clean-svn-tag-support-for-capistrano-2/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2007/09/11/clean-svn-tag-support-for-capistrano-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamically adding routes from your engine plugins</title>
		<link>http://yanpritzker.com/2007/03/27/dynamically-adding-routes-from-your-engine-plugins/</link>
		<comments>http://yanpritzker.com/2007/03/27/dynamically-adding-routes-from-your-engine-plugins/#comments</comments>
		<pubDate>Tue, 27 Mar 2007 19:08:30 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2007/03/27/dynamically-adding-routes-from-your-engine-plugins/</guid>
		<description><![CDATA[At Cohesive FT I am developing a sort of webmin console that has drop-in pluggable components. I am using the RoR plugin system with the engines plugin to drop entire chunks of MVC infrastructure into my application as required. This is all well and good except that rails engines require you to add this line [...]]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://cohesiveft.com">Cohesive FT</a> I am developing a sort of webmin console that has drop-in pluggable components. I am using the RoR plugin system with the engines plugin to drop entire chunks of MVC infrastructure into my application as required. This is all well and good except that rails engines require you to add this line into your routes.rb:</p>
<p><code>map.from_plugin :your_plugin_name</code></p>
<p>Now since I want a truly plug-n-play system, I can&#8217;t be modifying the route file of my main application. So here is a quick solution to import all the routes (note that in engine-plugin style you do not use the &#8220;map.&#8221; prefix for your routes, so I am adding that in)</p>
<p><code><br />
  #--routes.rb of the main applicatoin--<br />
  Dir["#{RAILS_ROOT}/vendor/plugins/*"].each do |plugin|<br />
    File.open("#{plugin}/routes.rb").each do |line|<br />
      eval "map.#{line}"<br />
    end<br />
  end<br />
</code></p>
<p>That&#8217;s all folks!</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2007/03/27/dynamically-adding-routes-from-your-engine-plugins/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2007/03/27/dynamically-adding-routes-from-your-engine-plugins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rails 1.2 breaks url routing with dots?</title>
		<link>http://yanpritzker.com/2007/02/27/rails-12-breaks-url-routing-with-dots/</link>
		<comments>http://yanpritzker.com/2007/02/27/rails-12-breaks-url-routing-with-dots/#comments</comments>
		<pubDate>Tue, 27 Feb 2007 05:12:41 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2007/02/27/rails-12-breaks-url-routing-with-dots/</guid>
		<description><![CDATA[This last week we&#8217;ve spent migrating Planypus from Rails 1.1.6 to the latest 1.2.1 release. Unfortunately the Rails 1.2 rewrite of the routing system leaves something to be desired. Apparently, the dot &#8220;.&#8221; (period) character is now considered a route separator, causing routes that have dots in them to break badly. Why is this bad? [...]]]></description>
			<content:encoded><![CDATA[<p>This last week we&#8217;ve spent migrating <a href="http://planyp.us">Planypus</a> from Rails 1.1.6 to the latest 1.2.1 release. Unfortunately the Rails 1.2 rewrite of the routing system leaves something to be desired. Apparently, the dot &#8220;.&#8221; (period) character is now considered a route separator, causing routes that have dots in them to break badly. Why is this bad? Well let&#8217;s say you were routing based on numbers, like lat/long coordinates..oops! Broken! Or, let&#8217;s say you were displaying users by their email (gmail has a prevalence of dots). Broken! I still love Rails, don&#8217;t get me wrong, but shouldn&#8217;t this sort of breakage be advertised just a little more loudly? Well here I am, yelling :-)</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2007/02/27/rails-12-breaks-url-routing-with-dots/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2007/02/27/rails-12-breaks-url-routing-with-dots/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Virtual Appliances running a rails admin console</title>
		<link>http://yanpritzker.com/2006/12/06/virtual-appliances-running-a-rails-admin-console/</link>
		<comments>http://yanpritzker.com/2006/12/06/virtual-appliances-running-a-rails-admin-console/#comments</comments>
		<pubDate>Wed, 06 Dec 2006 00:15:10 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2006/12/06/virtual-appliances-running-a-rails-admin-console/</guid>
		<description><![CDATA[Hello everyone, it&#8217;s been a while since I&#8217;ve written here mostly because I&#8217;ve been super busy at My new job at CohesiveFT. It&#8217;s been a fun and hectic several weeks, as I was dumped head first into a brand new environment and technology&#8211;building virtual appliances! We released two new versions of our financial trading appliances [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone, it&#8217;s been a while since I&#8217;ve written here mostly because I&#8217;ve been super busy at <a href="http://cohesiveft.com">My new job at CohesiveFT</a>. It&#8217;s been a fun and hectic several weeks, as I was dumped head first into a brand new environment and technology&#8211;building virtual appliances! </p>
<p>We released two new versions of our financial trading appliances available <a href="http://cohesiveft.com">on our website for free download</a>. The virtual appliances can be run in vmware or Parallels, and feature a web admin console I wrote in Ruby on Rails (but of course). So you can boot them up on pretty much any environment and you&#8217;ve got a nice plug-n-play way to administer the appliance and so on.</p>
<p>Of course, all of my other copious spare time has been taken up by <a href="http://planyp.us">Planypus</a>, where we have recently surpassed 1200 registered users! Come check it out and start making plans with your friends the easy way!</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2006/12/06/virtual-appliances-running-a-rails-admin-console/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2006/12/06/virtual-appliances-running-a-rails-admin-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

