<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0">
  <channel>
    <title>rails-bestpractices.com</title>
    <link>http://rails-bestpractices.com</link>
    <description>Learn the best practices of rails app and share your rails best practices</description>
    <language>en-us</language>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rails-bestpractices" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="rails-bestpractices" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Not use time_ago_in_words</title>
      <description>It's very common for a rails developer to use time_ago_in_words to display time like "5 minutes ago", but it's too expensive to calculate the time in server side, you should utilize client cpu to calculate the time ago.     &lt;a href="http://rails-bestpractices.com/posts/105-not-use-time_ago_in_words"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/26-move-code-into-helper"&gt;Move code into helper&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/55-generate-polymorphic-url"&gt;Generate polymorphic url&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/57-substituting-before_filter-load_object"&gt;Substituting before_filter :load_object&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/72-remove-empty-helpers"&gt;Remove empty helpers&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>flyerhzm</author>
      <pubDate>2012-02-10 14:32:51 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/105-not-use-time_ago_in_words</link>
      <guid>http://rails-bestpractices.com/posts/105-not-use-time_ago_in_words</guid>
    </item>
    <item>
      <title>Name your model methods after their behavior, not implementation.</title>
      <description>Business model methods should be named after the logic / business value they provide, not the implementation details. Violations to this practice tend to show up on ActiveRecord models.    &lt;a href="http://rails-bestpractices.com/posts/90-name-your-model-methods-after-their-behavior-not-implementation"&gt;see more&lt;/a&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>brasten</author>
      <pubDate>2011-12-05 21:07:01 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/90-name-your-model-methods-after-their-behavior-not-implementation</link>
      <guid>http://rails-bestpractices.com/posts/90-name-your-model-methods-after-their-behavior-not-implementation</guid>
    </item>
    <item>
      <title>Use cells to abstract view widgets</title>
      <description>Rails developers always pay more attentions on models and controllers refactoring, they don't take care about views modularization, that makes view codes most difficult to maintain. Here I recommend you to use cells gem to write more reuseable, testable and cacheable view codes.    &lt;a href="http://rails-bestpractices.com/posts/89-use-cells-to-abstract-view-widgets"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/8-model-collection_model_ids-many-to-many"&gt;model.collection_model_ids (many-to-many)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/9-nested-model-forms"&gt;Nested Model Forms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/24-move-code-into-controller"&gt;Move code into controller&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/25-move-code-into-model"&gt;Move code into model&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>flyerhzm</author>
      <pubDate>2011-11-06 10:39:34 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/89-use-cells-to-abstract-view-widgets</link>
      <guid>http://rails-bestpractices.com/posts/89-use-cells-to-abstract-view-widgets</guid>
    </item>
    <item>
      <title>Optimize db migration</title>
      <description>rails migration provides a convenient way to alter database structure, you can easily add, change and drop column to a existing table, but when the data in existing table are huge, it will take a long time to alter existing table, you should try to merge/optimize the db alter sql statements.    &lt;a href="http://rails-bestpractices.com/posts/87-optimize-db-migration"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/20-isolating-seed-data"&gt;Isolating Seed Data&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/21-always-add-db-index"&gt;Always add DB index&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/32-double-check-your-migrations"&gt;Double-check your migrations&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/46-use-say-and-say_with_time-in-migrations-to-make-a-useful-migration-log"&gt;Use say and say_with_time in migrations to make a useful migration log&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>flyerhzm</author>
      <pubDate>2011-10-30 09:00:25 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/87-optimize-db-migration</link>
      <guid>http://rails-bestpractices.com/posts/87-optimize-db-migration</guid>
    </item>
    <item>
      <title>Restrict auto-generated routes.</title>
      <description>By default, Rails generates seven RESTful routes(new,edit,create,destroy,index,show, update) for a resource, sometime the resource only needs one or two routes, so just user :only or :except while defining routes to speedup the routing.     &lt;a href="http://rails-bestpractices.com/posts/86-restrict-auto-generated-routes"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/10-overuse-route-customizations"&gt;Overuse route customizations&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/11-needless-deep-nesting"&gt;Needless deep nesting&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/12-not-use-default-route-if-you-use-restful-design"&gt;Not use default route if you use RESTful design&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/73-split-route-namespaces-into-different-files"&gt;split route namespaces into different files&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>yorzi</author>
      <pubDate>2011-08-19 09:21:15 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/86-restrict-auto-generated-routes</link>
      <guid>http://rails-bestpractices.com/posts/86-restrict-auto-generated-routes</guid>
    </item>
    <item>
      <title>Remove tab</title>
      <description>Using tabs can mess up the spacing since some IDE's use 4 spaces for a tab, while others use 2, and some people don't use tabs at all, a mix of tabs and spaces causes things to not line up in most cases.    &lt;a href="http://rails-bestpractices.com/posts/81-remove-tab"&gt;see more&lt;/a&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>flyerhzm</author>
      <pubDate>2011-07-04 14:38:05 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/81-remove-tab</link>
      <guid>http://rails-bestpractices.com/posts/81-remove-tab</guid>
    </item>
    <item>
      <title>Active Record Query Interface Optimization</title>
      <description>Use  select  with  has_many and belongs_to on Active Record Associations     &lt;a href="http://rails-bestpractices.com/posts/80-active-record-query-interface-optimization"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/1-move-finder-to-named_scope"&gt;Move finder to named_scope&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/2-use-model-association"&gt;Use model association&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/4-add-model-virtual-attribute"&gt;Add model virtual attribute&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/5-use-model-callback"&gt;Use model callback&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>angelo capilleri</author>
      <pubDate>2011-06-23 11:58:31 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/80-active-record-query-interface-optimization</link>
      <guid>http://rails-bestpractices.com/posts/80-active-record-query-interface-optimization</guid>
    </item>
    <item>
      <title>Create base conroller </title>
      <description>Have base controllers for DRY    &lt;a href="http://rails-bestpractices.com/posts/77-create-base-conroller"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/1-move-finder-to-named_scope"&gt;Move finder to named_scope&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/2-use-model-association"&gt;Use model association&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/3-use-scope-access"&gt;Use scope access&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/4-add-model-virtual-attribute"&gt;Add model virtual attribute&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>guolei</author>
      <pubDate>2011-06-02 06:42:31 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/77-create-base-conroller</link>
      <guid>http://rails-bestpractices.com/posts/77-create-base-conroller</guid>
    </item>
    <item>
      <title>Keep code struture in models consistent</title>
      <description>When the business logic of models becomes complex, it's very helpful to keep a consistent code structure that is agreed by team members.      &lt;a href="http://rails-bestpractices.com/posts/75-keep-code-struture-in-models-consistent"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/1-move-finder-to-named_scope"&gt;Move finder to named_scope&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/2-use-model-association"&gt;Use model association&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/4-add-model-virtual-attribute"&gt;Add model virtual attribute&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/5-use-model-callback"&gt;Use model callback&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>guolei</author>
      <pubDate>2011-05-31 17:12:58 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/75-keep-code-struture-in-models-consistent</link>
      <guid>http://rails-bestpractices.com/posts/75-keep-code-struture-in-models-consistent</guid>
    </item>
    <item>
      <title>Namespaced models</title>
      <description>Make the app/models more clear using namespaced models    &lt;a href="http://rails-bestpractices.com/posts/74-namespaced-models"&gt;see more&lt;/a&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/1-move-finder-to-named_scope"&gt;Move finder to named_scope&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/2-use-model-association"&gt;Use model association&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/4-add-model-virtual-attribute"&gt;Add model virtual attribute&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://rails-bestpractices.com/posts/5-use-model-callback"&gt;Use model callback&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;
	&lt;p&gt;
		&lt;b&gt;Subscribe&lt;/b&gt; to &lt;a href="http://feeds.feedburner.com/rails-bestpractices-team-blog"&gt;our team blog&lt;/a&gt;, you will get more information about rails_best_practices gem.&lt;/p&gt;
&lt;/div&gt;
</description>
      <author>guolei</author>
      <pubDate>2011-05-31 15:22:44 UTC</pubDate>
      <link>http://rails-bestpractices.com/posts/74-namespaced-models</link>
      <guid>http://rails-bestpractices.com/posts/74-namespaced-models</guid>
    </item>
  </channel>
</rss>

