Home Improvement - http://www.homesaaz.net
Learn basic things on rails developer and development
http://www.homesaaz.net/articles/11148/1/Learn-basic-things-on-rails-developer-and-development/Page1.html
Peter Joseph
By Peter Joseph
Published on 01/19/2010
 
No versioning the source code (not using the any version controlling software). Not using DRY concept extensively

Learn basic things on rails developer and development
1. The main idea of DRY is that if code which is repeated is extracted to a helper or function, you only have one place to look for (and edit) your code if and when something goes wrong. If you find that similar code is used in several places, you may want to look into extracting that code to a helper function or partial.

2. Not using Ruby on Rails features extensively such as AR associations, SVN/Git, Capistrano for deployment.

3. Missing migration functionality.

4. Fetching whole bunch of fields from different tables ,Select necessary fields using: select keyword  in AR model.(it will avoid unnecessary field values to be fetched )

5. Not using constants where needed. Instead of repeating the creation of strings, variables(class, instance and session objects) like the address of your customer service reply email, set it once in constant (in environment. rb or the appropriate environment file) and use that throughout your application.

6. Using global variables, class variables. Session object should be used limitedly

Top features and tips each Rails Developer should know

a. Know the convention over configuration:

i. There are a set of naming conventions in Ruby on rails developer. The various concepts (like tables in the DB, controllers, Model objects, routing rules) are typically wired together by convention. That means that you need to know exactly when to use upper-case, camel-case, lower-case, underscore, etc.

b. Migrations:

i. Migrations are database agnostic. What this means is that you can write your description of the database in ruby -once- and have it easily translate to MySQL, PostgreSQL or SQLite out of the box.

ii. Migrations mean never having to say “I don’t know the create syntax in #{SQL_SERVER_X}”.

iii. Migrations allow for different versions of a database. This means that when you decide to add user authentication on that application that you know is horribly insecure, but “it would interfere with existing infrastructure”, you can do so easily and without complications.

iv. Because migrations allow for easy changes to database schemas it allows for good iterative development.

c. Usage of constants and objects:

i. Don’t use Global variables and Class variables. Avoid using Session objects. Use constants wherever needed, set it once in a constant (in environment.rb or the appropriate environment file) and use that throughout your application.

d. Use :select keyword:

i. Active Record: while querying database table, please select the necessary fields to fetch by: select keyword

e. Know this:

i. In Boolean context everything except nil and false is considered true, including 0, 0.0, "", [], {} etc.

ii. Ruby syntax tries to be nice most of the time but sometimes it bites you. For example when you try to pass empty hash to a method you don't say obj.foo {} as that would be interpreted as a block, you need to say obj.foo({}). There are some more cases when you need to use explicit parenthesis.

f. Usage of Agile development methodology and Unit testing habits