<?xml version="1.0" encoding="UTF-8"?>
<tricks type="array">
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-08-04T17:55:29+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">366</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">2</nvotes>
    <permalink>non_active_record_model</permalink>
    <published-at type="datetime" nil="true"></published-at>
    <state>queued</state>
    <summary>This episode of Railscasts will show you how to make a model which isn't based on Active Record. You may want to do this if a resource isn't backed by the database.</summary>
    <title>Non Active Record Model</title>
    <updated-at type="datetime">2008-08-04T19:40:16+02:00</updated-at>
    <updater-id type="integer">2</updater-id>
    <url>http://railscasts.com/episodes/121-non-active-record-model</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content nil="true"></content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile nil="true"></content-textile>
    <created-at type="datetime">2008-07-26T14:40:23+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">347</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">3</nvotes>
    <permalink>session_based_model</permalink>
    <published-at type="datetime">2008-07-30T16:01:15+02:00</published-at>
    <state>published</state>
    <summary>If you have a lot of logic associated with the data inside a session, you'll need some central location to put this logic. See how to create a session based model in this episode of Railscasts.</summary>
    <title>Session Based Model</title>
    <updated-at type="datetime">2008-07-30T18:01:16+02:00</updated-at>
    <updater-id type="integer">2</updater-id>
    <url>http://railscasts.com/episodes/119</url>
    <url-code nil="true"></url-code>
  </trick>
  <trick>
    <category-id type="integer">7</category-id>
    <comments type="integer"></comments>
    <content>&lt;p&gt;If you want to know how your database schema looks like, you have three options: connect to your database and do it with &lt;em&gt;&lt;span class=&quot;caps&quot;&gt;DESCRIBE&lt;/span&gt; table&lt;/em&gt;, check the file &lt;em&gt;db/schema.rb&lt;/em&gt; or use the &lt;strong&gt;annotate_models&lt;/strong&gt; plugin:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
script/plugin install http://repo.pragprog.com/svn/Public/plugins/annotate_models
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Now you just have to run the new rake task &lt;strong&gt;annotate_models&lt;/strong&gt;:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
rake annotate_models
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Open one of your model files and you&amp;#8217;ll see a new comment block that looks like this:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
# == Schema Information
# Schema version: 53
#
# Table name: vendors
#
#  id         :integer(11)     not null, primary key
#  vclass     :string(255)
#  name       :string(255)
#  vid        :integer(11)
#  created_at :datetime
#  updated_at :datetime
#  creator_id :integer(11)
#  updater_id :integer(11)
#
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;You should run the rake task every time you do a migration to keep the annotation up-to-date. It&amp;#8217;s trivial but very helpful. I couldn&amp;#8217;t live without this plugin.&lt;/p&gt;


	&lt;p&gt;For more Rails tricks, &lt;a href=&quot;http://howflow.com/tags/rails&quot;&gt;click here&lt;/a&gt;&lt;/p&gt;</content>
    <content-bbcode nil="true"></content-bbcode>
    <content-format>Textile</content-format>
    <content-html nil="true"></content-html>
    <content-textile>p. If you want to know how your database schema looks like, you have three options: connect to your database and do it with _DESCRIBE table_, check the file _db/schema.rb_ or use the *annotate_models* plugin:


&lt;pre&gt;
&lt;code&gt;
script/plugin install http://repo.pragprog.com/svn/Public/plugins/annotate_models
&lt;/code&gt;
&lt;/pre&gt;


p. Now you just have to run the new rake task *annotate_models*:


&lt;pre&gt;
&lt;code&gt;
rake annotate_models
&lt;/code&gt;
&lt;/pre&gt;


p. Open one of your model files and you'll see a new comment block that looks like this:


&lt;pre&gt;
&lt;code&gt;
# == Schema Information
# Schema version: 53
#
# Table name: vendors
#
#  id         :integer(11)     not null, primary key
#  vclass     :string(255)
#  name       :string(255)
#  vid        :integer(11)
#  created_at :datetime
#  updated_at :datetime
#  creator_id :integer(11)
#  updater_id :integer(11)
#
&lt;/code&gt;
&lt;/pre&gt;


p. You should run the rake task every time you do a migration to keep the annotation up-to-date. It's trivial but very helpful. I couldn't live without this plugin.


p. For more Rails tricks, &quot;click here&quot;:http://howflow.com/tags/rails</content-textile>
    <created-at type="datetime">2008-05-25T13:23:06+02:00</created-at>
    <creator-id type="integer">1</creator-id>
    <deleted-at type="datetime" nil="true"></deleted-at>
    <file nil="true"></file>
    <id type="integer">197</id>
    <lang-id type="integer" nil="true"></lang-id>
    <locale>en</locale>
    <nreports type="integer">0</nreports>
    <nvotes type="integer">3</nvotes>
    <permalink>annotate_your_models</permalink>
    <published-at type="datetime">2008-05-25T17:34:17+02:00</published-at>
    <state>published</state>
    <summary>This is actually a very old trick, because annotate_models is one of the older Rails plugins. On the other hand, I realized that only a few people have heard of it.</summary>
    <title>Annotate Your Models</title>
    <updated-at type="datetime">2008-05-25T19:34:19+02:00</updated-at>
    <updater-id type="integer">8</updater-id>
    <url>http://pragdave.pragprog.com/pragdave/2006/02/annotate_models.html</url>
    <url-code nil="true"></url-code>
  </trick>
</tricks>
