<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Rails: Importing data from spreadsheets into database</title>
	<atom:link href="http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/feed/" rel="self" type="application/rss+xml" />
	<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/</link>
	<description>Ruby on Rails, Web 2.0, Wordpress and more...</description>
	<lastBuildDate>Fri, 30 Jul 2010 17:15:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Nithin Bekal</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-1446</link>
		<dc:creator>Nithin Bekal</dc:creator>
		<pubDate>Fri, 30 Jul 2010 17:15:28 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-1446</guid>
		<description>@NealMJD. Thank you for the comment. I suppose the problem with putting the task in lib folder was because the path to images is relative to the root folder.</description>
		<content:encoded><![CDATA[<p>@NealMJD. Thank you for the comment. I suppose the problem with putting the task in lib folder was because the path to images is relative to the root folder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NealJMD</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-1439</link>
		<dc:creator>NealJMD</dc:creator>
		<pubDate>Thu, 29 Jul 2010 20:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-1439</guid>
		<description>I just want to add a note that I discovered when I was using this tutorial to set up my rake task. I needed to create entries in a database each of which with an image. I&#039;m using paperclip by thoughtbot for image storage so I did this - 

&lt;pre&gt;FasterCSV.foreach(&quot;product_categories.csv&quot;) do &#124;row&#124;
      puts row[0]
      puts row[1]
      ProductCategory.create(
                 :name =&gt; row[0].to_s,
                 :main_image =&gt; File.open(row[1].to_s)
               )
end&lt;/pre&gt;

I ended up putting in those puts just to give a little more info when the task is run. Additionally I had to put my product_categories.csv file in the root directory of my app. Anyway this post saved me a ton of time, thanks for writing it!</description>
		<content:encoded><![CDATA[<p>I just want to add a note that I discovered when I was using this tutorial to set up my rake task. I needed to create entries in a database each of which with an image. I&#8217;m using paperclip by thoughtbot for image storage so I did this &#8211; </p>
<pre>FasterCSV.foreach("product_categories.csv") do |row|
      puts row[0]
      puts row[1]
      ProductCategory.create(
                 :name =&gt; row[0].to_s,
                 :main_image =&gt; File.open(row[1].to_s)
               )
end</pre>
<p>I ended up putting in those puts just to give a little more info when the task is run. Additionally I had to put my product_categories.csv file in the root directory of my app. Anyway this post saved me a ton of time, thanks for writing it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nithin Bekal</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-1387</link>
		<dc:creator>Nithin Bekal</dc:creator>
		<pubDate>Sat, 17 Jul 2010 16:35:40 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-1387</guid>
		<description>@anon. Thanks. :)</description>
		<content:encoded><![CDATA[<p>@anon. Thanks. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anon</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-1384</link>
		<dc:creator>anon</dc:creator>
		<pubDate>Fri, 16 Jul 2010 21:40:09 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-1384</guid>
		<description>awesome tutorial.  worked like a charm; way easier than most of the other tutorials I&#039;ve seen out there for this kinda stuff.</description>
		<content:encoded><![CDATA[<p>awesome tutorial.  worked like a charm; way easier than most of the other tutorials I&#8217;ve seen out there for this kinda stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nithin Bekal</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-1285</link>
		<dc:creator>Nithin Bekal</dc:creator>
		<pubDate>Fri, 25 Jun 2010 16:30:40 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-1285</guid>
		<description>@gnitmada. Put it in the lib/tasks directory.</description>
		<content:encoded><![CDATA[<p>@gnitmada. Put it in the lib/tasks directory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gnitmada</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-1280</link>
		<dc:creator>gnitmada</dc:creator>
		<pubDate>Thu, 24 Jun 2010 21:35:43 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-1280</guid>
		<description>What rails directory does the file need to be put in?</description>
		<content:encoded><![CDATA[<p>What rails directory does the file need to be put in?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nithin Bekal</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-749</link>
		<dc:creator>Nithin Bekal</dc:creator>
		<pubDate>Thu, 18 Mar 2010 14:44:04 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-749</guid>
		<description>@Josh. Thanks. :)</description>
		<content:encoded><![CDATA[<p>@Josh. Thanks. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh P</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-727</link>
		<dc:creator>Josh P</dc:creator>
		<pubDate>Mon, 15 Mar 2010 22:08:05 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-727</guid>
		<description>And BTW Nithin, great little tutorial, worked perfectly :)</description>
		<content:encoded><![CDATA[<p>And BTW Nithin, great little tutorial, worked perfectly :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh P</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-726</link>
		<dc:creator>Josh P</dc:creator>
		<pubDate>Mon, 15 Mar 2010 22:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-726</guid>
		<description>Hey Mark, 

Just thought I would chime as I was in your boots only a few weeks ago. In ROR models are *somewhat* similar to tables.

It sounds like you need a good introduction to ROR before you try importing csv data. The best *intro* ROR book I read was:

Simply Rails by Patrick Lenz

Check it out and good luck. 

Josh</description>
		<content:encoded><![CDATA[<p>Hey Mark, </p>
<p>Just thought I would chime as I was in your boots only a few weeks ago. In ROR models are *somewhat* similar to tables.</p>
<p>It sounds like you need a good introduction to ROR before you try importing csv data. The best *intro* ROR book I read was:</p>
<p>Simply Rails by Patrick Lenz</p>
<p>Check it out and good luck. </p>
<p>Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nithin Bekal</title>
		<link>http://nithinbekal.com/2009/12/09/rails-importing-data-from-spreadsheets-into-database/comment-page-1/#comment-516</link>
		<dc:creator>Nithin Bekal</dc:creator>
		<pubDate>Thu, 04 Feb 2010 04:30:47 +0000</pubDate>
		<guid isPermaLink="false">http://nithinbekal.com/?p=118#comment-516</guid>
		<description>Hi Mark. Do you have a model associated with the people table? If you do, then you&#039;ll have a file in the app/models directory called people with something like this:

&lt;pre&gt;&lt;code&gt;
class User &lt; ActiveRecord::Base
  # associations and validations described here.
end
&lt;/code&gt;&lt;/pre&gt;

This rake will only work if you already have a model. If you are importing the data into a rails application, it seems logical that you create the model first and then do the importing. Btw, what error did you get when you ran the rake task?</description>
		<content:encoded><![CDATA[<p>Hi Mark. Do you have a model associated with the people table? If you do, then you&#8217;ll have a file in the app/models directory called people with something like this:</p>
<pre><code>
class User < ActiveRecord::Base
  # associations and validations described here.
end
</code></code></pre>
<p>This rake will only work if you already have a model. If you are importing the data into a rails application, it seems logical that you create the model first and then do the importing. Btw, what error did you get when you ran the rake task?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
