<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: ruby code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Wed, 23 Jul 2008 20:45:08 GMT</pubDate>
    <description>DZone Snippets: ruby code</description>
    <item>
      <title>Migration to change all MySQL table engines to InnoDB</title>
      <link>http://snippets.dzone.com/posts/show/4601</link>
      <description>I have a database with an eclectic mix of table types/engines - almost random between MyISAM and InnoDB.  I wanted to get transactional, so I wrote this migration to bring everything in line.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class ChangeTableTypes &lt; ActiveRecord::Migration&lt;br /&gt;  &lt;br /&gt;  def self.up&lt;br /&gt;    ActiveRecord::Migration::say 'Setting all tables to InnoDB engine (excluding schema_info table)...'&lt;br /&gt;    result = ActiveRecord::Migration::execute 'show tables'&lt;br /&gt;    while table = result.fetch_row&lt;br /&gt;      execute("ALTER TABLE #{table.to_s} TYPE = InnoDB") unless table.to_s == 'schema_info'&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  def self.down&lt;br /&gt;    raise ActiveRecord::IrreversibleMigration&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.bjhess.com"&gt;Barry Hess&lt;/a&gt;</description>
      <pubDate>Mon, 01 Oct 2007 18:52:50 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4601</guid>
      <author>bjhess (Barry Hess)</author>
    </item>
    <item>
      <title>Rails auto select text field</title>
      <link>http://snippets.dzone.com/posts/show/4561</link>
      <description>A simple helper to create those snazzy on-click-auto-select text fields you see on all the video-sharing sites.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def auto_select_text_field_tag(name, value = nil, options = {})&lt;br /&gt;  text_field_tag(name,&lt;br /&gt;                 value,&lt;br /&gt;                 { :onclick =&gt; "$(&#8217;#{name}&#8217;).select()",&lt;br /&gt;                   :readonly =&gt; "true" }.merge(options))&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A _little_ more info &lt;a href="http://bjhess.com/bjhessblog/2007/09/12/rails-auto-select-text-field-tag/"&gt;on my blog&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;~Barry Hess</description>
      <pubDate>Thu, 20 Sep 2007 20:10:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4561</guid>
      <author>bjhess (Barry Hess)</author>
    </item>
  </channel>
</rss>
