<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>ruby on rails blog</title>
	
	<link>http://jonathansng.com</link>
	<description>class AllYourCode &lt; Us</description>
	<lastBuildDate>Sat, 31 Oct 2009 02:53:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/JonathanSNg" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Using a Rails collection partial with a counter</title>
		<link>http://jonathansng.com/ruby-on-rails/using-a-rails-collection-partial-with-a-counter/</link>
		<comments>http://jonathansng.com/ruby-on-rails/using-a-rails-collection-partial-with-a-counter/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 02:48:15 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[partials]]></category>
		<category><![CDATA[render collection]]></category>
		<category><![CDATA[render partial collection]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=295</guid>
		<description><![CDATA[I was reworking an application today and noticed there was a portion of the code that was rendering a counter.

# what I saw
&#60;% @wheels.each_with_index do &#124;wheel,count&#124; %&#62;
  &#60;%= render :partial =&#62; &#34;wheel&#34;, :locals =&#62; &#123; :wheel =&#62; wheel, :count =&#62; count&#125; %&#62;
&#60;% end %&#62;
&#160;
# you might also be doing
&#60;% count =0 %&#62;
&#60;% @wheels.each do [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/using-a-rails-collection-partial-with-a-counter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple database connections with Rails</title>
		<link>http://jonathansng.com/ruby-on-rails/multiple-database-connections-with-rails/</link>
		<comments>http://jonathansng.com/ruby-on-rails/multiple-database-connections-with-rails/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 20:22:47 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[legacy databases]]></category>
		<category><![CDATA[multiple databases]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=283</guid>
		<description><![CDATA[Recently a client requsted that I add a new admnistration panel to an existing Rails application. I thought to myself, &#8220;That sounds simple enough?&#8221;; welll, things are never as simple. In addition to this control panel, they wanted to use an existing MySQL database and its contents which, of course, did not follow the Rails [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/multiple-database-connections-with-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cisco VPN and Snow Leopard</title>
		<link>http://jonathansng.com/osx/cisco-vpn-and-snow-leopard/</link>
		<comments>http://jonathansng.com/osx/cisco-vpn-and-snow-leopard/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 21:47:24 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[osx]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[cisco vpn]]></category>
		<category><![CDATA[snow leopard]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=267</guid>
		<description><![CDATA[After upgrading to Snow Leopard 10.6 I&#8217;ve run into yet another quirk. I tried to log on to our VPN and the Cisco VPN client gave me me the following dialog box: &#8220;Error 51: Unable to communicate with the VPN subsystem. Please make sure that you have at least one network interface that is currently [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/osx/cisco-vpn-and-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Watermarking images paperclip’s post-processor</title>
		<link>http://jonathansng.com/ruby-on-rails/watermarking-images-paperclips-post-processor/</link>
		<comments>http://jonathansng.com/ruby-on-rails/watermarking-images-paperclips-post-processor/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 21:44:02 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=258</guid>
		<description><![CDATA[For those of you who wanted to use thoughtbot&#8217;s paperclip plugin to manage image uploads but were having trouble watermarking said images, behold!
http://github.com/ng/paperclip-watermarking-app/tree/master
]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/watermarking-images-paperclips-post-processor/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dynamically set a domain for a Rails asset host</title>
		<link>http://jonathansng.com/ruby-on-rails/dynamically-set-a-domain-for-a-rails-asset-host/</link>
		<comments>http://jonathansng.com/ruby-on-rails/dynamically-set-a-domain-for-a-rails-asset-host/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 10:07:51 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[asset host]]></category>
		<category><![CDATA[asset hosts]]></category>
		<category><![CDATA[asset_host]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=254</guid>
		<description><![CDATA[I&#8217;ve been wanting to implement an asset host for my Rails app, looking over the API I saw that Rails&#8217; asset_host only supported a single domain. I&#8217;m running multiple domains off one Rails app, so this would have been a problem. After a little research, I came up with a solution that would work for [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/dynamically-set-a-domain-for-a-rails-asset-host/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Simple non-model check box properties</title>
		<link>http://jonathansng.com/ruby-on-rails/simple-non-model-check-box-properties/</link>
		<comments>http://jonathansng.com/ruby-on-rails/simple-non-model-check-box-properties/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 11:11:01 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[check boxes]]></category>
		<category><![CDATA[check_box_tag]]></category>
		<category><![CDATA[non-model check box]]></category>
		<category><![CDATA[non-model properties]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=252</guid>
		<description><![CDATA[Need to pass a property that isn&#8217;t associated with a model? I did. It took me a few minutes, but the solution is pretty easy. 
Instead of passing the instance variable your form is using, try this.

&#60;% form_for &#91;:admin, @post&#93;&#125; do &#124;f&#124; %&#62;
  &#60;%= f.error_messages %&#62;
&#160;
	&#60;p&#62;
		&#60;%= f.label :title %&#62;
		&#60;%= f.text_field :title %&#62;
	&#60;/p&#62;
&#160;
	&#60;p&#62;
		&#60;%= label&#40;:skip_queue, &#34;Skip [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/simple-non-model-check-box-properties/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Paperclip deletes images with empty file fields update with rails 2.3</title>
		<link>http://jonathansng.com/ruby-on-rails/paperclip-deletes-images-with-empty-file-fields-update-with-rails-23/</link>
		<comments>http://jonathansng.com/ruby-on-rails/paperclip-deletes-images-with-empty-file-fields-update-with-rails-23/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 09:30:44 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails 2.3]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=249</guid>
		<description><![CDATA[Bahhh! When you update a model that contains an empty file field in Rails 2.3 the attachment is deleted. It looks like empty file fields get passed as nil and then Paperclip gets angry.

Processing Admin::PostsController#update (for 127.0.0.1 at 2009-03-05 01:21:08) [PUT]
  Parameters: &#123;&#34;commit&#34;=&#62;&#34;Update&#34;, &#34;post&#34;=&#62;&#123;&#34;title&#34;=&#62;&#34;Post Title&#34;, &#34;image&#34;=&#62;nil&#125;, &#34;id&#34;=&#62;&#34;124&#34;&#125;

There are two quick monkey patches that I&#8217;ve [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/paperclip-deletes-images-with-empty-file-fields-update-with-rails-23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watermark your images in Rails</title>
		<link>http://jonathansng.com/ruby-on-rails/watermark-your-images-in-rails/</link>
		<comments>http://jonathansng.com/ruby-on-rails/watermark-your-images-in-rails/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 22:39:03 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=245</guid>
		<description><![CDATA[I&#8217;ve been working on a project that requires me to watermark all my images. Here&#8217;s a script I put together using rmagick. I plan on releasing a skeleton application that will accept uploaded files and watermark them.
Ideally, I&#8217;d like to use paperclip to handle uploading, and write a processor subclass to handle watermarking&#8230;unfortunately I&#8217;m running [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/watermark-your-images-in-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Paperclip not saving your images?</title>
		<link>http://jonathansng.com/ruby-on-rails/paperclip-not-saving-your-images/</link>
		<comments>http://jonathansng.com/ruby-on-rails/paperclip-not-saving-your-images/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 07:23:21 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[paperclip]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=242</guid>
		<description><![CDATA[I&#8217;ve had a few guys email me asking if I had any idea why Paperclip wasn&#8217;t saving their uploaded images. Here&#8217;s a form one of them sent me:

&#60;% form_for&#40;@post&#41; do &#124;f&#124; %&#62;
  &#60;%= f.error_messages %&#62;
&#160;
&#160;
    &#60;%= f.label :title %&#62;
    &#60;%= f.text_field :title %&#62;
&#160;
&#160;
&#160;
    &#60;%= f.label [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/paperclip-not-saving-your-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if a file exists in Rails</title>
		<link>http://jonathansng.com/ruby-on-rails/check-if-a-file-exists-in-rails/</link>
		<comments>http://jonathansng.com/ruby-on-rails/check-if-a-file-exists-in-rails/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 00:15:14 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://jonathansng.com/?p=236</guid>
		<description><![CDATA[Recently I was porting a legacy PHP application to Rails. One of the primary tasks was to resize a bunch of images. Below you can see what one of the database rows looks like.

mysql&#62; SELECT id, filename FROM old_posts
+----+---------------------------------------+
&#124; id &#124; filename              [...]]]></description>
		<wfw:commentRss>http://jonathansng.com/ruby-on-rails/check-if-a-file-exists-in-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 1.204 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-11-09 15:19:43 --><!-- Compression = gzip -->
