<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Custom rake tasks in Merb: Data Backup and Import</title>
	<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/</link>
	<description>A developer\'s blog</description>
	<pubDate>Thu, 11 Mar 2010 21:42:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: jc</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-23893</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Sun, 27 Sep 2009 10:13:16 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-23893</guid>
		<description>adapter.send(:with_connection) do &#124;connection&#124;
              adapter.execute("INSERT INTO #{model_class.name.pluralize.snake_case} (#{fixture.keys.collect{&#124;key&#124; adapter.send(:quote_name, key.to_s)}.join(",")}) VALUES (#{values.collect {&#124;value&#124; connection.quote_value(value)}.join(",")})")
            end</description>
		<content:encoded><![CDATA[<p>adapter.send(:with_connection) do |connection|<br />
              adapter.execute(&#8221;INSERT INTO #{model_class.name.pluralize.snake_case} (#{fixture.keys.collect{|key| adapter.send(:quote_name, key.to_s)}.join(&#8221;,&#8221;)}) VALUES (#{values.collect {|value| connection.quote_value(value)}.join(&#8221;,&#8221;)})&#8221;)<br />
            end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jc</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-23891</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Sun, 27 Sep 2009 09:30:07 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-23891</guid>
		<description>This no longer works in datamapper 0.10. quote_column_name no longer exists on adapter. Supposedly its in the connection now, but I cant find it</description>
		<content:encoded><![CDATA[<p>This no longer works in datamapper 0.10. quote_column_name no longer exists on adapter. Supposedly its in the connection now, but I cant find it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Stolz</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-19829</link>
		<dc:creator>Brian Stolz</dc:creator>
		<pubDate>Fri, 10 Jul 2009 16:36:30 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-19829</guid>
		<description>I was having issues with join tables which have names such as "roles_users" because of the double pluralization.

To resolve this I changed:

INSERT INTO #{table.name.pluralize.snake_case}

to:

INSERT INTO #{table.storage_name}

This uses the proper table name instead.</description>
		<content:encoded><![CDATA[<p>I was having issues with join tables which have names such as &#8220;roles_users&#8221; because of the double pluralization.</p>
<p>To resolve this I changed:</p>
<p>INSERT INTO #{table.name.pluralize.snake_case}</p>
<p>to:</p>
<p>INSERT INTO #{table.storage_name}</p>
<p>This uses the proper table name instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jc</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-15367</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Sun, 05 Apr 2009 08:51:41 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-15367</guid>
		<description>Here's what the timestamps look like in the YML file

  :created_at: 2009-03-31T00:04:45-07:00
  :updated_at: 2009-03-31T00:04:45-07:00</description>
		<content:encoded><![CDATA[<p>Here&#8217;s what the timestamps look like in the YML file</p>
<p>  :created_at: 2009-03-31T00:04:45-07:00<br />
  :updated_at: 2009-03-31T00:04:45-07:00</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jc</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-15366</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Sun, 05 Apr 2009 08:50:59 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-15366</guid>
		<description>Looks like its a YAML bug. Tracked here:
http://redmine.ruby-lang.org/issues/show/752

It fails just loading the generated YAML file.
irb(main):014:0&#62; YAML.load_file "config/data/development/Job.yml"
ArgumentError: time out of range
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `utc'
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `node_import'
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `load'
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `load'
	from /opt/local/lib/ruby/1.8/yaml.rb:144:in `load_file'</description>
		<content:encoded><![CDATA[<p>Looks like its a YAML bug. Tracked here:<br />
<a href="http://redmine.ruby-lang.org/issues/show/752" rel="nofollow">http://redmine.ruby-lang.org/issues/show/752</a></p>
<p>It fails just loading the generated YAML file.<br />
irb(main):014:0&gt; YAML.load_file &#8220;config/data/development/Job.yml&#8221;<br />
ArgumentError: time out of range<br />
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `utc&#8217;<br />
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `node_import&#8217;<br />
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `load&#8217;<br />
	from /opt/local/lib/ruby/1.8/yaml.rb:133:in `load&#8217;<br />
	from /opt/local/lib/ruby/1.8/yaml.rb:144:in `load_file&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mikong</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-14574</link>
		<dc:creator>mikong</dc:creator>
		<pubDate>Mon, 23 Mar 2009 02:06:39 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-14574</guid>
		<description>I have created_at and updated_at in several places in the project that I used this. I didn't have any problems. Can you give more details about your environment? The Merb version and DM version you're using, what your database is, and maybe how your updated_at/created_at data looks like in your YAML file?

I like YAML because it has a nice format, and it's quite easy to modify the data before loading it. I guess if I had your errors and couldn't make YAML work, then I'd consider other solutions. Btw, it's not exactly my solution. As mentioned above, I just translated Tobi's work which I think is amazing coz it was an old article, and yet it just worked for my case.

Anyway, I hope you could give me the details of your environment so I can take a look at the problem.</description>
		<content:encoded><![CDATA[<p>I have created_at and updated_at in several places in the project that I used this. I didn&#8217;t have any problems. Can you give more details about your environment? The Merb version and DM version you&#8217;re using, what your database is, and maybe how your updated_at/created_at data looks like in your YAML file?</p>
<p>I like YAML because it has a nice format, and it&#8217;s quite easy to modify the data before loading it. I guess if I had your errors and couldn&#8217;t make YAML work, then I&#8217;d consider other solutions. Btw, it&#8217;s not exactly my solution. As mentioned above, I just translated Tobi&#8217;s work which I think is amazing coz it was an old article, and yet it just worked for my case.</p>
<p>Anyway, I hope you could give me the details of your environment so I can take a look at the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jc</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-14557</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Sun, 22 Mar 2009 23:00:34 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-14557</guid>
		<description>Hrmmm.. the load task doesn't work. It croaks on the created_at and updated_at columns. "Invalid time"

Seems like YAML is a very odd choice for this. Why not just use sql in and sql out? The data format conversions make things very unstable.</description>
		<content:encoded><![CDATA[<p>Hrmmm.. the load task doesn&#8217;t work. It croaks on the created_at and updated_at columns. &#8220;Invalid time&#8221;</p>
<p>Seems like YAML is a very odd choice for this. Why not just use sql in and sql out? The data format conversions make things very unstable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mikong</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-13138</link>
		<dc:creator>mikong</dc:creator>
		<pubDate>Mon, 02 Mar 2009 16:36:59 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-13138</guid>
		<description>Hi Philippe,

I suggest you try dumping some data so you can see the yaml expected. Here's an example data dump on my side:

&lt;code&gt;
--- 
- :word: burger
  :id: 1
- :word: food
  :id: 2
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi Philippe,</p>
<p>I suggest you try dumping some data so you can see the yaml expected. Here&#8217;s an example data dump on my side:</p>
<p><code><br />
---<br />
- :word: burger<br />
  :id: 1<br />
- :word: food<br />
  :id: 2<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe Rathé</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-13013</link>
		<dc:creator>Philippe Rathé</dc:creator>
		<pubDate>Sun, 01 Mar 2009 20:15:06 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-13013</guid>
		<description>Can you tell me what your script expect as yaml syntax?
I get the following error:
rake aborted!
undefined method `keys' for ["reason1", {"name"=&#62;"My own reason"}]:Array

With this yaml:
reason1:
    name: My own reason

Thanks</description>
		<content:encoded><![CDATA[<p>Can you tell me what your script expect as yaml syntax?<br />
I get the following error:<br />
rake aborted!<br />
undefined method `keys&#8217; for [&#8221;reason1&#8243;, {&#8221;name&#8221;=&gt;&#8221;My own reason&#8221;}]:Array</p>
<p>With this yaml:<br />
reason1:<br />
    name: My own reason</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Uri</title>
		<link>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-9032</link>
		<dc:creator>Uri</dc:creator>
		<pubDate>Tue, 16 Dec 2008 20:27:02 +0000</pubDate>
		<guid>http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/#comment-9032</guid>
		<description>Thanks!</description>
		<content:encoded><![CDATA[<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
