<?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>Rails of Fury &#187; jondruse</title>
	<atom:link href="http://jondruse.com/author/jondruse/feed/" rel="self" type="application/rss+xml" />
	<link>http://jondruse.com</link>
	<description>a simple man :: on a mission</description>
	<lastBuildDate>Fri, 27 Aug 2010 05:09:41 +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>Dynamic placeholder images in Paperclip</title>
		<link>http://jondruse.com/2010/08/dynamic-placeholder-images-in-paperclip/</link>
		<comments>http://jondruse.com/2010/08/dynamic-placeholder-images-in-paperclip/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 05:09:41 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=142</guid>
		<description><![CDATA[Tonight I was integrating Thoughtbot&#8217;s Paperclip plugin as I have done many times before. Only this time I realized what a pain it really is to deal with missing images. Paperclip does a pretty good job at this by looking ...]]></description>
			<content:encoded><![CDATA[<p>Tonight I was integrating Thoughtbot&#8217;s Paperclip plugin as I have done many times before.  Only this time I realized what a pain it really is to deal with missing images.  Paperclip does a pretty good job at this by looking for a &#8220;default_url&#8221; which you can set in your model. This is good, until you&#8217;re more than a few models in. Then I found <a href="http://www.suffix.be/blog/default-image-paperclp/">this solution.</a> Now we&#8217;re getting somewhere. But I still thought, why can&#8217;t this be completely dynamic?  Well it can, and pretty easily I might add. </p>
<p>First go get <a href="http://github.com/mdarby/placeholder">mdarby&#8217;s placeholder on the github</a>.  This gem makes use of <a href="http://placehold.it">placehold.it</a>&#8216;s super easy api for creating, you guessed it, placeholder images.  It&#8217;s actually quite useful.</p>
<p>Next we have to monkey patch paperclip.  Create an initializer file called paperclip.rb and drop in the following.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#6666ff; font-weight:bold;">Paperclip::Attachment</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> url<span style="color:#006600; font-weight:bold;">&#40;</span>style_name = default_style, use_timestamp = <span style="color:#0066ff; font-weight:bold;">@use_timestamp</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; url = original_filename.<span style="color:#0000FF; font-weight:bold;">nil</span>? ? get_placeholder<span style="color:#006600; font-weight:bold;">&#40;</span>style_name<span style="color:#006600; font-weight:bold;">&#41;</span> : interpolate<span style="color:#006600; font-weight:bold;">&#40;</span>@url, style_name<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; use_timestamp <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> updated_at ? <span style="color:#006600; font-weight:bold;">&#91;</span>url, updated_at<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">compact</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>url.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;?&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#996600;">&quot;&amp;&quot;</span> : <span style="color:#996600;">&quot;?&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : url<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span> &nbsp;<br />
&nbsp; <br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> get_placeholder<span style="color:#006600; font-weight:bold;">&#40;</span>style_name<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; Placeholder.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>styles<span style="color:#006600; font-weight:bold;">&#91;</span>style_name<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">geometry</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Placeholder&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">url</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>Basically we&#8217;re just overriding this method to generate a placehold.it url when the attachment is not present.  One downside to this method is that it overrides is globally. You will no longer be able to set the &#8220;default_url&#8221; in your model.  But hey that&#8217;s the whole point of this anyway right?  Right.  I plan to fork paperclip and try to get this in as an actual option, but we&#8217;ll see how long that takes.  Anyway, enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2010/08/dynamic-placeholder-images-in-paperclip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Things Android wishes it did better than iPhone OS</title>
		<link>http://jondruse.com/2010/06/10-things-android-wishes-it-did-better-than-iphone-os/</link>
		<comments>http://jondruse.com/2010/06/10-things-android-wishes-it-did-better-than-iphone-os/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 22:12:15 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=133</guid>
		<description><![CDATA[I read on Gizmodo today 10 Things Android Does Better Than iPhone OS and it made me very unhappy. As an owner of both systems I think I have some insight into how things really are. Maybe in a perfect ...]]></description>
			<content:encoded><![CDATA[<p>I read on Gizmodo today <a href="http://gizmodo.com/5554293/10-things-android-does-better-than-iphone-os?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed:+gizmodo/full+(Gizmodo)#comentform">10 Things Android Does Better Than iPhone OS</a> and it made me very unhappy.  As an owner of both systems I think I have some insight into how things really are.</p>
<p>Maybe in a perfect world all those things would actually make the phone better, but here in the real world, they just make the phone slower.  Widgets, multitasking, social networking and notifications really just get in the way of doing useful things. Proof of this is the fact that I have to have an app just to kill all the apps that stay running after I close them.  And the mysterious apps that start whenever they feel like it.  Also the fact that I have to restart my phone every day to keep it running at top performance (like actually being able to make and receive phone calls).  I would leave my iPhone on for MONTHS without any loss of performance.</p>
<p>To say that the App Store is inferior to the Android Marketplace is just ridiculous. The truth is on either market the ratio of total crap to anything useful is about 1000:1.  Therefore, since the App Store has roughly 3 times as many apps, you&#8217;re bound to get better options.</p>
<p>Both systems look stunning in pictures and on feature lists.  But the iPhone clearly stands alone in the real world.  Yeah you can&#8217;t have a calendar widget on the iPhone.  But on the iPhone when you open apps, you don&#8217;t have to sit there waiting for them.  They open quickly and let you get on with your life.</p>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2010/06/10-things-android-wishes-it-did-better-than-iphone-os/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>25 questions every programmer should ask on a job interview</title>
		<link>http://jondruse.com/2010/05/25-questions-every-programmer-should-ask-on-a-job-interview/</link>
		<comments>http://jondruse.com/2010/05/25-questions-every-programmer-should-ask-on-a-job-interview/#comments</comments>
		<pubDate>Wed, 19 May 2010 00:06:18 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=125</guid>
		<description><![CDATA[The last few jobs I&#8217;ve had proved to be somewhat disappointing. What I realized after a few months was that it was mostly my fault for not asking the right questions.  In a way a job interview is really for ...]]></description>
			<content:encoded><![CDATA[<p>The last few jobs I&#8217;ve had proved to be somewhat disappointing. What I realized  after a few months was that it was mostly my fault for not asking the right questions.  In a way a job interview is really for both parties. Not only do they have to think  that you fit in, but you have to think that you&#8217;ll enjoy working there. These 25 questions are what I should have asked. Hopefully they can spur you on to write your own, or you can just take these. Either way it&#8217;s important to figure out what you&#8217;re looking for in a job or career.</p>
<p><strong>General Questions:</strong></p>
<ol>
<li>Is there a dress code?</li>
<li>What are the normal business hours?</li>
<li>Who would I report to, and what are his/her hours?</li>
<li>Do you offer benefits?</li>
<li>What is the waiting period for benefits?</li>
<li>What is your policy on working from home?</li>
<li>Wow much vacation/sick time would I get?</li>
<li>What is the average length of employment?</li>
<li>What is a typical day/week like?</li>
<li>What is an atypical day/week like?</li>
<li>What would my workstation be like?</li>
<li>How many people are on the team?</li>
</ol>
<p><strong>Technical Questions:</strong></p>
<ol>
<li>What version of ruby/rails are you currently running?</li>
<li>Do you plan to upgrade?</li>
<li>How closely do you follow ruby/rails conventions? (MVC, db schema, etc.)</li>
<li>Do you work as a team?</li>
<li>Does code get reviewed before it can be committed? By Who?</li>
<li>How much test coverage does the project have?</li>
<li>What is your deployment strategy? (shell script, capistrano, CI, etc.)</li>
<li>Do you use git? svn? other?</li>
<li>Do you have a development strategy? What is it?</li>
<li>Do you have a regular release cycle?</li>
<li>What platform would I be developing on? (mac, linux, windows)</li>
<li>Would I be able to bring my own computer?</li>
<li>How to you project the application will progress in 6 months? 1 year, 5 years?</li>
</ol>
<p>You can obviously swap ruby/rails for whatever you&#8217;re working with. The point is that you know what you&#8217;re getting yourself into. Remember, just as you are putting your best foot forward, so are they. Not that they are intentionally deceiving you, but they probably won&#8217;t naturally offer this information. So it&#8217;s up to you to find out.</p>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2010/05/25-questions-every-programmer-should-ask-on-a-job-interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tabbed Interface &#8211; A new rails plugin</title>
		<link>http://jondruse.com/2009/08/tabbed-interface-a-new-rails-plugin/</link>
		<comments>http://jondruse.com/2009/08/tabbed-interface-a-new-rails-plugin/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 16:32:09 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=111</guid>
		<description><![CDATA[It&#8217;s not like we really need a new rails plugin, but this one I really saw the need for. Tabbed interfaces can really improve how your website looks and flows. Here&#8217;s a great article from smashingmagazine about how, when and ...]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not like we really need a new rails plugin, but this one I really saw the need for.  Tabbed interfaces can really improve how your website looks and flows. Here&#8217;s a great article from <a href="http://www.smashingmagazine.com/2009/06/24/module-tabs-in-web-design-best-practices-and-solutions/" target="blank">smashingmagazine</a> about how, when and why to use tabbed interfaces. Here&#8217;s a quick rundown of the plugin.  Let me know what you think!</p>
<p><strong>TabbedInterface</strong></p>
<p>Build a tabbed interface very easily.  Requires Prototype.</p>
<p>see a working example at <a href="http://tab-interface.heroku.com">http://tab-interface.heroku.com<br />
</a><br />
<strong>Install</strong></p>
<p>./script/plugin install git://github.com/jondruse/tabbed_interface.git</p>
<p>Move the ajax-loader.gif from the resources folder to your public images folder, or go make one at <a href="http://www.ajaxload.info/">http://www.ajaxload.info/</a>.  Whatever you do, just make sure you call it ajax-loader.gif.</p>
<p>An example css file is also included in the resources folder.</p>
<p><strong>Example</strong></p>
<p>In this simple example we setup a TabbedInterface with two tabs.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&lt;%</span> tabbed_content <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>box<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
<br />
&nbsp; # You don't have to include these. &nbsp;They are the defaults, but this is how you would change them.<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">content_wrapper</span> = <span style="color:#996600;">&quot;tabbed_content&quot;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">navigation_wrapper</span> = <span style="color:#996600;">&quot;tabbed_navigation&quot;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">tab_tag</span> = <span style="color:#ff3333; font-weight:bold;">:li</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">tabs_tag</span> = <span style="color:#ff3333; font-weight:bold;">:ul</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
<br />
&nbsp; # Let's add some tabs!<br />
&nbsp; # All you need is a title and a url. Also accepts two options hashes that get passed directly to the link_to_remote <br />
&nbsp; call.<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">tab</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Test One&quot;</span>, test_one_path, <span style="color:#006600; font-weight:bold;">&#123;</span>:method <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:post</span><span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>:<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;different-class&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">tab</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Test Two&quot;</span>, test_two_path<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; <br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> box.<span style="color:#9900CC;">content</span> = capture <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
&nbsp; &nbsp; # Put your default content here (probably the content for the the first tab, but doesn't have to be)<br />
&nbsp; &nbsp; Default text<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span><br />
<br />
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></div></div>
<p>The tabbed_content helper yields an object that has two main methods.</p>
<p>#tab</p>
<p>This method will setup a new tab header.  Just pass the title and the url to call and update the main content area.</p>
<p>#content</p>
<p>The only requirement is that you use capture (as shown above).  This sets the default content for the interface. Then when you click on a different tab, the content will be updated. You can put anything in here, but it will probably be a partial, being that the links use link_to_remote to update the main content area.  There are no limitations on how any tabs you can have, or how many interfaces you can have on a page.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2009/08/tabbed-interface-a-new-rails-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pesky form error markup in Rails</title>
		<link>http://jondruse.com/2009/06/pesky-form-error-markup-in-rails/</link>
		<comments>http://jondruse.com/2009/06/pesky-form-error-markup-in-rails/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 17:41:06 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=84</guid>
		<description><![CDATA[Have you ever spent hours coding up the most awesome form you&#8217;ve ever seen only to have Rails break it with it&#8217;s error markup? I have, and it really sucks. So today I set out on a mission to solve ...]]></description>
			<content:encoded><![CDATA[<p>Have you ever spent hours coding up the most awesome form you&#8217;ve ever seen only to have Rails break it with it&#8217;s error markup?  I have, and it really sucks. So today I set out on a mission to solve this ever annoying problem.  Here&#8217;s how I did it.</p>
<p><strong>Step 1. Find the source.</strong></p>
<p>If you&#8217;ve ever gone looking through Rails source, you know this wasn&#8217;t a very easy thing to do. But after some digging I found what was causing me so much grief.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#008000; font-style:italic;"># active_record_helper.rb in action_pack/action_view/helpers</span><br />
@@field_error_proc = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>html_tag, instance<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#996600;">&quot;&lt;div class=<span style="color:#000099;">\&quot;</span>fieldWithErrors<span style="color:#000099;">\&quot;</span>&gt;#{html_tag}&lt;/div&gt;&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div></div>
<p><strong>Step 2. Figure out what you want.</strong></p>
<p>I found that the problem was that it was using a div to wrap the incorrect fields. This didn&#8217;t work for me.  I needed a span so it wouldn&#8217;t break the layout.  So what do you need?  Maybe a div works, but you want to use a different class name?  Whatever it is, figure it out.  Firebug may be of some help to you.</p>
<p><strong>Step 3.  Patch Rails.</strong></p>
<p>I love how easy this step is.  Put a file in RAILS_ROOT/config/initializers called rails_ext.rb.  You can really name this file whatever you want, but that&#8217;s what mine is called. </p>
<p>Next add these lines.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">module</span> ActionView<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">class</span> Base<br />
&nbsp; &nbsp; @@field_error_proc = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>html_tag, instance<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#996600;">&quot;&lt;span class=<span style="color:#000099;">\&quot;</span>fieldWithErrors<span style="color:#000099;">\&quot;</span>&gt;#{html_tag}&lt;/span&gt;&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; cattr_accessor <span style="color:#ff3333; font-weight:bold;">:field_error_proc</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>Now restart your server and enjoy.</p>
<p><strong>Closing Thoughts.</strong></p>
<p>Now I know what you&#8217;re thinking.  Why don&#8217;t I just edit the css?  Well here it is.  My markup is a big deal.  If I want a span I should have a span.  I guess it really comes down to preference. Take it or leave it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2009/06/pesky-form-error-markup-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leveraging the power of inheritance in Rails.</title>
		<link>http://jondruse.com/2009/06/leveraging-the-power-of-inheritance-in-rails/</link>
		<comments>http://jondruse.com/2009/06/leveraging-the-power-of-inheritance-in-rails/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 05:52:31 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=17</guid>
		<description><![CDATA[Here&#8217;s a neat trick.  It&#8217;s pretty simple but really helpful. Problem: You&#8217;re always setting up the same stuff in every controller. Layouts, helper methods and so on. Solution: Set up your own controller to inherit from. Throw this into a ...]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a neat trick.  It&#8217;s pretty simple but really helpful. </p>
<p><strong>Problem</strong>: You&#8217;re always setting up the same stuff in every controller.  Layouts, helper methods and so on.  </p>
<p><strong>Solution</strong>: Set up your own controller to inherit from.</p>
<p>Throw this into a new file in the controllers folder called base_controller.rb.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> BaseController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController<br />
&nbsp; <br />
&nbsp; layout <span style="color:#996600;">&quot;base&quot;</span><br />
&nbsp; helper <span style="color:#ff3333; font-weight:bold;">:my_cool_helper</span> &nbsp;<br />
<br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>Now take any controller and change the first line like below.  Now anything in BaseController you get for free.  So in the example below, PostsController&#8217;s layout will be &#8220;base&#8221; and will have the MyCoolHelper included also.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> PostsController <span style="color:#006600; font-weight:bold;">&lt;</span> BaseController<br />
<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> list<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>Wow, that was easy.  Now it&#8217;s much easier to make (and change) default behaviors in your app.  Hope this helps you, it sure helped me.</p>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2009/06/leveraging-the-power-of-inheritance-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Documentation for Apple Dictionary</title>
		<link>http://jondruse.com/2009/06/git-documentation-for-apple-dictionary/</link>
		<comments>http://jondruse.com/2009/06/git-documentation-for-apple-dictionary/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 16:14:52 +0000</pubDate>
		<dc:creator>jondruse</dc:creator>
				<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://jondruse.com/?p=20</guid>
		<description><![CDATA[A couple months ago I found Priit Haamer&#8217;s blog post about the Ruby Dictionary for Mac OS X. So now I&#8217;ve ported the Git Documentation to Dictionary.app also. Please let me know of any bugs.  Enjoy! Download Download gitdictionary file ...]]></description>
			<content:encoded><![CDATA[<p>A couple months ago I found Priit Haamer&#8217;s blog post about the <a href="http://priithaamer.com/blog/ruby-dictionary-for-mac-os-x">Ruby Dictionary for Mac OS X</a>. So now I&#8217;ve ported the Git Documentation to Dictionary.app also. Please let me know of any bugs.  Enjoy!</p>
<div><strong>Download</strong></div>
<div><strong><br />
</strong></div>
<div>
<ol>
<li>Download <a href="http://jondruse.com/wp-content/uploads/2009/06/gitdictionary.zip">gitdictionary</a> file <span style="font-weight: bold;">(&lt;1MB, works only with 10.5 Leopard)</span> and proceed to installation instructions.</li>
</ol>
</div>
<div><strong>Installation</strong></div>
<div><strong><br />
</strong></div>
<ol>
<li>Unzip downloaded file into <span style="font-weight: bold;">~/Library/Dictionaries</span> folder if you want to keep this dictionary only for yourself. You may need to create this folder if you haven&#8217;t installed any dictionaries before.</li>
<li>To make the searching with Spotlight work, open Dictionary.app preferences pane and drag &#8220;Git&#8221; from the dictionaries list from bottom to the top because only the first one in this list will be searched from Spotlight.</li>
<li>To make it available for all users on your computer, drop the <span style="font-weight: bold;">Git.dictionary</span> folder into <span style="font-weight: bold;">/Library/Dictionaries</span> folder.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jondruse.com/2009/06/git-documentation-for-apple-dictionary/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
