- 1.0.0 (0)
- 1.1.0 (3)
- 1.1.1 (0)
- 1.1.6 (1)
- 1.2.0 (14)
- 1.2.6 (2)
- 2.0.0 (16)
- 2.0.1 (0)
- 2.0.3 (3)
- 2.1.0 (38)
- 2.2.1 (14)
- 2.3.2 (13)
- 2.3.8 (-2)
- 3.0.0 (-1)
- 3.0.5 (3)
- 3.0.7 (0)
- 3.0.9 (20)
- 3.1.0 (11)
- 3.2.1 (0)
- 3.2.3 (0)
- 3.2.8 (1)
- 3.2.13 (0)
- What's this?
- dani posted note Update the uniqueness field when it value dependent on another existent field without uniqueness restriction. 2 days ago
- dani posted note Migration for uniqueness with existent data in DB 2 days ago
- lkyrala posted note usage examples 5 days ago
- Scudelletti posted note Redirect Status 6 days ago
- mattsa posted note Updated list of statuses 12 days ago
- ribbitfix posted note Updated link for the Reisner blog post 16 days ago
- RafaelPerea posted note BEWARE of options[:value] in a partial 20 days ago
- julescopeland posted note Adjacency 25 days ago
- julescopeland posted note Take care with time ranges 25 days ago
- joshuapinter posted note Use `update_all` for Updating the Same Column for Multiple Records. 29 days ago
- Makes it possible to use a scope through an association posted by noniq is now a good note 2 months ago
Welcome to Rails
Understanding the MVC pattern is key to understanding Rails. MVC divides your application into three layers, each with a specific responsibility.
The View layer is composed of “templates” that are responsible for providing appropriate representations of your application’s resources. Templates can come in a variety of formats, but most view templates are HTML with embedded Ruby code (.erb files).
The Model layer represents your domain model (such as Account, Product, Person, Post) and encapsulates the business logic that is specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and embellish these data objects with business logic methods. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the ActiveModel module. You can read more about Active Record in its README.
The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually this means returning HTML, but Rails controllers can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers manipulate models and render view templates in order to generate the appropriate HTTP response.
In Rails, the Controller and View layers are handled together by Action Pack. These two layers are bundled in a single package due to their heavy interdependence. This is unlike the relationship between Active Record and Action Pack which are independent. Each of these packages can be used independently outside of Rails. You can read more about Action Pack in its README.
Install Rails at the command prompt if you haven’t yet:
gem install rails
At the command prompt, create a new Rails application:
rails new myapp
where “myapp” is the application name.
Change directory to myapp and start the web server:
cd myapp; rails server
Run with --help for options.
Go to http://localhost:3000 and you’ll see:
"Welcome aboard: You're riding Ruby on Rails!"
Follow the guidelines to start developing your application. You may find the following resources handy:
The README file created within your application.
The Ruby on Rails Guides.
The API Documentation.
Ruby on Rails is released under the MIT license.
Latest good notes
- Makes it possible to use a scope through an association by noniq at 1 Oct
- Disable STI by gabeodess at 25 Sep
- W3CDTF Format by moiristo at 12 Sep
- Have check_box checked by default by spectator at 14 Aug
- How to specify :only_path when non-hash options by zubin at 17 Jul
- Undocumented :location option by szeryf at 11 Jul
- Careful with this method. by arronwashington at 26 Jun
- Possible gotcha by szeryf at 25 Mar
Top contributors of last 30 days
- alloy with 1 received thank
- alvin2ye with 1 received thank
- Mange with 1 received thank
- victorgrey with 1 received thank
- wiseleyb with 1 received thank