This link has been bookmarked by 97 people . It was first bookmarked on 08 Mar 2006, by Maggie Tsai.
-
27 Sep 11
-
13 Oct 10
-
27 Jan 09
-
Rails Best Practices, Tips and Tricks
-
-
28 Jul 08
-
27 Jul 08
-
17 May 08
-
13 Apr 08
-
23 Mar 08
-
21 Mar 08
-
08 Mar 08
-
23 Feb 08
-
08 Jan 08
Jason Fowlerraction of SaltedHashLoginGenerator, and as such, has the disadvantages that SaltedHash has. Additionally, it uses the Rails Engines system which is designed for drop in use. In general, applications need customization. If you need more than simple modifi
rails rubyonrails bestpractices tips programming development howto ruby cheatsheet
-
19 Dec 07
-
05 Oct 07
-
09 Sep 07
-
23 Aug 07
-
20 Aug 07
Hendy IrawanThis is absolutely essential. Rails makes writing unit and functional tests incredibly easy and testing should be employed at all times. Positive and negative testing should be employed: the first to verify that the application does what it is supposed to
-
31 Jul 07
-
07 Jun 07
-
17 May 07
-
02 Apr 07
-
27 Mar 07
-
21 Mar 07
-
08 Feb 07
-
12 Jan 07
-
19 Dec 06
-
15 Dec 06
-
14 Nov 06
-
Authentication Systems
Several authentication modules have been written for Rails, but some are better at some things and some are better than others.
-
Some sort of source control should be used at all times. This allows for easy roll back if something goes wrong as well as the ability to refer back to old code if needed. Rails has certain files which should not be included in a source control repository, so please refer to the wiki page when preparing the initial import.
-
Don’t use abbreviations, especially in database column names. It should be immediately obvious what the column is for (or atleast what the name means) when looking at the name. These are not the days of C, we don’t need to conserve space with our variable names. Additionally, Rails error handling automatically knows how to “humanize” column names, so when you use a well described name you get to work less on outputting errors.
-
you may want to look into extracting that code to a helper function or partial.
-
You should always run svn update before generating a migration so you don’t have prefix collisions
-
Migrations mean never having to say you’re sorry because you nuked the database. They allow for database agnostic schemas which means you can develop locally on SQLite and deploy on MySQL without a problem. They’re cleaner (and easier) than writing your own schemas custom and should be used whenever possible.
-
Functional testing is used to test controllers.
-
As a general rule, unit testing should test any validation in models as well as any added methods in those models
-
NEVER EVER EVER modify schema.rb. It is a reflection of the database. Migrations should be used to move this forward. If you don’t use migrations and instead modify schema.rb, things will break and people will be unhappy.
-
-
07 Nov 06
-
31 Oct 06
-
24 Oct 06
-
30 Aug 06
-
07 Aug 06
-
06 Aug 06
-
02 Aug 06
-
20 Jul 06
-
25 Jun 06
-
12 Jun 06
-
29 May 06
-
10 May 06
-
12 Apr 06
-
11 Apr 06
-
25 Mar 06
-
24 Mar 06
-
23 Mar 06
-
15 Mar 06
-
09 Mar 06
-
08 Mar 06
-
Testing
This is absolutely essential. Rails makes writing unit and functional tests incredibly easy and testing should be employed at all times. Positive and negative testing should be employed: the first to verify that the application does what it is supposed to when the proper variables are passed to the correct action and then second to verify that when incorrect variables are passed the prefered behavior occurs.
-
Migrations
Migrations mean never having to say you’re sorry because you nuked the database. They allow for database agnostic schemas which means you can develop locally on SQLite and deploy on MySQL without a problem. They’re cleaner (and easier) than writing your own schemas custom and should be used whenever possible.
-
-
07 Mar 06
-
02 Mar 06
-
17 Feb 06
-
10 Feb 06
-
09 Feb 06
-
08 Feb 06
-
07 Feb 06
-
Miska Lahti"Because Rails is a young framework, I thought it would be helpful to write up what I consider best practices when coding with it both for my new coworkers and the web at large. Here’s my current draft."
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.