Skip to content

Instantly share code, notes, and snippets.

@ddeveloperr
Created February 5, 2016 22:56
Show Gist options
  • Select an option

  • Save ddeveloperr/6cf096988730c0140fc3 to your computer and use it in GitHub Desktop.

Select an option

Save ddeveloperr/6cf096988730c0140fc3 to your computer and use it in GitHub Desktop.
Explained ORM in Ruby on Rails?
##
* ORM is Object Relational Mapper. It means you don't have to manually call the database yourself; the ORM handles it for you.
* Ruby on Rails uses one called ActiveRecord, and it's a really good one.
* ORM allows you to do things such as:
User.find(50).contacts
Instead of manually writing a SELECT statement with JOINs, WHEREs, etc.
**********
* Active Record as an ORM Framework
* Active Record gives us several mechanisms, the most important being the ability to:
> Represent models and their data.
> Represent associations between these models.
> Represent inheritance hierarchies through related models.
> Validate models before they get persisted to the database.
> Perform database operations in an object-oriented fashion.
MORE DETAILS:
http://api.rubyonrails.org/files/activerecord/README_rdoc.html
http://www.sitepoint.com/orm-ruby-introduction/
http://guides.rubyonrails.org/active_record_basics.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment