<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Chee's blog &#187; plugins</title>
	<atom:link href="http://cheeyeo.wordpress.com/category/plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://cheeyeo.wordpress.com</link>
	<description>Observations, tips, tricks, articles on Ruby and anything else that follows.</description>
	<lastBuildDate>Wed, 18 Mar 2009 00:19:55 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='cheeyeo.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/1c59aee0b01111d834f3bfb3e82f9b0d?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Chee's blog &#187; plugins</title>
		<link>http://cheeyeo.wordpress.com</link>
	</image>
			<item>
		<title>Fixing attachment_fu undefined method error</title>
		<link>http://cheeyeo.wordpress.com/2009/02/19/fixing-attachment_fu-undefined-method-error/</link>
		<comments>http://cheeyeo.wordpress.com/2009/02/19/fixing-attachment_fu-undefined-method-error/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 22:36:24 +0000</pubDate>
		<dc:creator>cheeyeo</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://cheeyeo.wordpress.com/?p=47</guid>
		<description><![CDATA[How to fix undefined method error with using the attachment_fu plugin on Ruby 1.8.7<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=47&subd=cheeyeo&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hello there. First of all apologies for not posting for a while. I have been busy working on commercial Rails projects for the very first time and as such, that takes precedence. However, I am also aware of the need to keep blogging and keep up the practise more as a note to myself about the things I have encountered through work and also to show potential exmployers that I KNOW WHAT I AM TALKING ABOUT.</p>
<p>To start off 2009, I would like to highlight an interesting error I came across today with regards to using attachment_fu plugin. It is a great plugin for handling file uploads in Rails and there are plenty of resources on the web to get you started. The issue arose when I fired up an old Rails application running on 2.0.2 with a view that uses attachment_fu for uplaods. The following error appears on the console:</p>
<p><strong>NoMethodError in XXXController<br />
</strong></p>
<p><strong>undefined method `[]&#8216; for #&lt;Enumerable::Enumerator&#8230;&#8230;..&gt; </strong></p>
<p>So I upgraded to Rails 2.1 and 2.2 but the error still persisted. It transpired that it is a conflict with the verion of Ruby you have running on your system (I use a MAC running on Ruby 1.8.7.) &#8211; it appears to be an issue with Ruby 1.8.7 &#8217;s string methods mdofications.</p>
<p>To fix it simply navigate to vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb and change the following line:</p>
<p><strong><br />
</strong></p>
<p><strong>attachment_options[:path_prefix]   = attachment_options[:path_prefix]<br />
[1..-1] if options[:path_prefix].starts_with?(&#8216;/&#8217;) </strong></p>
<p>Note that starts_with? is a String method only in 1.8.7. Save an relaunch yor application and all should be well.</p>
<p>I obtained the above from the following google group link:</p>
<p>http://groups.google.com/group/attachment_fu/browse_thread/thread/502dd4504a59c84d</p>
<p>Hope this helps someone &#8211; certainly helps me after hours of debugging!</p>
<p>P/S if the above has changed since then please let me know as I may not be the most up to date.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cheeyeo.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cheeyeo.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cheeyeo.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cheeyeo.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cheeyeo.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cheeyeo.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cheeyeo.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cheeyeo.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cheeyeo.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cheeyeo.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=47&subd=cheeyeo&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cheeyeo.wordpress.com/2009/02/19/fixing-attachment_fu-undefined-method-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cheeyeo</media:title>
		</media:content>
	</item>
	</channel>
</rss>