Ruby on Rails is a framework for the Ruby language, which is used for rapid development of web applications. It does this by allowing you to concentrate on solving your clients’ problems and not getting caught up in building an infrastructure to support your clients problem.
Let’s face it, you don’t want to build database access layer every time you start a new project. Neither will you want to implement a fully functioning MVC pattern on a regular basis. This is the whole point of frameworks; they give you a starting point from which you can build upon. This allows you to concentrate on the clients needs, not the so-called yak shaving tasks, which can hold you back.
It’s worth mentioning MVC (Model-View-Controller) because it can be one of the factors that discourages people from trying frameworks like Rails. MVC is a relatively advanced programming topic, however, I’m not going to suggest you learn how to implement the MVC pattern, just learn how to make use of it. With this in mind let look what each of the letters in the acronym M.V.C. means and how they fit into web development.
The model layer is where you define classes for the data your application will use/store. For instance, if you want to store posts for a blog, you will have a “Post” model. The model has the capability to interact with the database, to retrieve and store data. This functionality is gained by inheriting it from the ActiveRecord super class. Any methods, which act upon this data, should also be placed in the model.
The view layer has one main purpose - to return the relevant HTML to be rendered on the users browser. In Rail a view is held in an erb (Embedded Ruby) file, which contains both HTML and embedded Ruby statements.
Without the controller, nothing would happen. The controller interacts with the model to retrieve and store data. It will then pass any data, acquired from the model, to the view. The view returns the resulting HTML to the controller and the controller sends this back to the users browser.
This is quite a concise overview of MVC. I highly recommend that you read up on this topic, as it is the key to cracking Rails. This article from betterexplained.com is a great resource for learning MVC in Rails. However, the best way to learn is, install the framework and start playing with it.
This article was written, by me, for Six Revisions - [Read More][article_id]
[article_id]: http://sixrevisions.com/web-development/how-to-create-a-blog-from-scratch-using-ruby-on-rails/ "Six Revisions"
This article will guide you through the process of installing Ruby on Rails, and any other software that is required to begin using it.
This is the first of two articles, Part 1 will show you how to install Ruby on Rails (on Windows) and Part 2 will show you how to create a basic blog.
In order to create a web application with Rails, you will need the following software:
Ruby is an interpreted language, which means that you don’t have to compile your code before you can execute it - it is interpreted at runtime. For this, we require the Ruby interpreter.
So let’s get started! To install the Ruby interpreter, you will need to download one-click installer.
After initiating the setup process, by double clicking on the one-click installer, you will be guided through the installation by the setup wizard, as follows:
This screen tells you what you are installing (Ruby!) and what version. Nothing much to see here, Click "Next" to move on...
I wrote this article for Six Revisions. Go there to read on.
Learning the MVC pattern is quite a daunting task, never mind learning a new language and a framework at the same time. Learning a framework that applies to the language you currently program in can ease this learning curve. For instance, if you’re a PHP developer, why not try learning CakePHP first or if you’re a Python developer, you could try learning Django. Once you get use to how the MVC pattern works it makes moving to another MVC based framework much easier.
Invest some time in learning, at least the basics of, the Ruby language. Ruby is a really nice language and you’ll be a better developer for learning it. Ruby is a fully capable object oriented language with some superb advanced features. Some resources, which you will find useful...
I wrote this article for Speckyboy Magazine [Read More][article_id].
[article_id]: http://speckyboy.com/2009/05/19/seven-practical-tips-to-getting-started-with-ruby-on-rails/
Wish I was there, unfortunately I'm just going to have to catch the PodCast. Looks like the main topic will be Rails 3 and what it is going to bring to community. For those of you who are living in a cave, Rails 3 will be an aggregate of the best parts of Ruby on Rails and the Merb frameworks.
The integration of some of the Merb ideas will see a more modular approach introduced to Rails. For instance, in the past you were forced to go with ActiveRecord for the object relational mapping. Going forward this will change, you will have the choice of ActiveRecord, Datamapper and Sequel. Nice!
Further to this, Rails with not favour specific javascript libraries i.e. Prototype and Scriptaculous. This will be a big plus for all the jQuery fans.
Rails will still have an opinion about what is used as a default. This is a good thing, we don't lots of configuration; after all, this is one the best features of Rails.
I'm looking forward to seeing what other features are in the pipeline.
Routing is one of those aspects of Rails which tends to get neglected. By just making a few small changed, you can significantly contribute to your SEO effort and to the readabilty/navigability of your web app.

If you have a blog, like I do, you may want to make your post archives available via easy to understand URLs. To do this you can create a new route in you routes.rb file as follows:-
So, lets step through this. First of all we map the path 'archives/:year/:month' - this specifies the format of the URL that this route will expect. Next, we state which controller and action will be called, in this case that will be the "posts" controller and the "find_by_date" action/method. Further to this, we can specify what pattern ":year" and ":month" should match with regular expressions. ":year" will match a four digit number and ":month" will match a month name in the example above. I have included some examples of the URLs this route will match:-
http://localhost:3000/archives/2007/mar
http://localhost:3000/archives/2008/apr
http://localhost:3000/archives/2009/may
You can then use the parameters ":year" and ":month" in your controller to retrieve the relevant data with a method similar to below:-
This is really simple. You can simply place the following method in your "Post" model (or whatever your model is called). Just remember to change the "title" field with whatever your post title field is.
Here, we are basically overriding the to_param method, which is used in ActiveRecord to return the its primary key. For more on this pop over to Obie Fernandez's blog.