• Home
  • About

stonean

Feeds:
Posts
Comments

RubyOnRails Interview Questions – 101

November 20, 2007 by stonean

Interview questions/answers for an entry level RubyOnRails developer:

Q) What site contains the Rails framework documentation?

A) api.rubyonrails.com

Note: When I was starting to learn Rails, there was always a tab open for this site. This is a guess that other developers learning Rails would be utilizing this page as well.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) What does RAILS_ROOT represent?

A) The base directory for your application.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) By convention, where are the images for the site stored?

A) RAILS_ROOT/public/images

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) Where do you put the database connection information?

A) A file named database.yml located in the RAILS_ROOT/config directory.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) List the directories located under the RAILS_ROOT/app directory.

A) controllers, views, helpers, models

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) By convention, if my model is named user.rb what will my table name be?

A) The table will be named users. Rails convention is to pluralize table names.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) What table is used to store the current migration version?

A) schema_info

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) What’s the command used to run a migration?

A) rake db:migrate

Note: Here are a couple parameters I use often:

  1. –trace : outputs the process details to the screen. useful for debugging
  2. VERSION=<num> : set which version this migration should be targeting. needed to roll back your database.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) Name some built-in validation methods.

A) Here’s a list of the methods I use the most. The full list can be found on the api site.

  • validates_presence_of
  • validates_uniqueness_of
  • validates_length_of
  • validates_format_of

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) What is the helper method to generate an anchor tag?

A) link_to

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Q) If I have a controller file RAILS_ROOT/app/controllers/orders_controller.rb where would the orders index.rhtml file be located?

A) RAILS_ROOT/app/views/orders/index.rhtml

Intermediate (201) and Advanced (301) questions will be posted in the coming weeks. I’ll also be updating this post as more questions come to mind.

Posted in Interview Questions, RubyOnRails | No Comments Yet

  • Open Source


    Lockdown (GitHub)
    RuHL (GitHub)

  • Recommend Me

  • twitter: stonean

    • Yet another way to waste time in the guise of keeping up to date: http://vurl.me/EIR 1 day ago
    • So I submitted my RailsConf proposal, called it Beyond MVC. We shall see. I do such a bad job talking about myself, the bio sucked. 1 day ago
    • @ubermuda that's good to know, thank you! 2 days ago
    • @chanmix51 cool, thanks! 2 days ago
    • In vi, :set list to show hidden characters, to revert, :set nolist Very handy. 2 days ago
  • Categories

    classy-inheritance Code Style DataMapper Fusion git Haml Interview Questions jQuery lockdown Merb MysqlUtils Process Quick Tips REST RSpec Ruby RubyOnRails rubytrends Stage thoughts Uncategorized


  • Archives

    • November 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007

Blog at WordPress.com.

Theme: Mistylook by Sadish.