Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ruby on Rails Primer

1,608 views

Published on

Ruby on Rails slide deck for Perth Coding for Hustler's course - May 2013

Published in: Technology
  • Be the first to comment

Ruby on Rails Primer

  1. 1. Ruby on RailsFriday, 17 May 13
  2. 2. What is Rails?Rails is a web application development frameworkwritten in the Ruby language. It is designed tomake programming web applications easier bymaking assumptions about what every developerneeds to get started.Friday, 17 May 13
  3. 3. Rails Concepts• DRY - “Don’t Repeat Yourself”• Convention Over Configuration• REST (CRUD)• MVC• Don’t Repeat YourselfFriday, 17 May 13
  4. 4. CRUD & RESTCRUD stands for create,read, update and destroy.REST stands for Representational State Transfer and is basically anexpansion of CRUD.REST uses resource identifiers such as URLs to represent resources.Example HTTP request:DELETE /users/1User resource with an id of 1, desired action - deleteFriday, 17 May 13
  5. 5. MVC• Model-View-Controller• Separates “business logic” from presentationlogic• “Business logic” typically consists of datamodels for resources (Users, Photos etc)• Presentation logic associated with a GUI - webpagesFriday, 17 May 13
  6. 6. MVC cont.• Browser sends a request for a page (i.e. /users/16)• Request gets received by server and passed onto a “controller”• A controller will either immediately render a “view” (template that getsconverted to HTML) or interact with a “model”.• Models are ruby objects that represents a resource and communicate with adatabase• After interacting with a model, the controller will then render a viewFriday, 17 May 13
  7. 7. Friday, 17 May 13
  8. 8. Friday, 17 May 13
  9. 9. RoutesFriday, 17 May 13
  10. 10. ControllerFriday, 17 May 13
  11. 11. ModelFriday, 17 May 13
  12. 12. View (index.html.erb)Friday, 17 May 13
  13. 13. ResultFriday, 17 May 13
  14. 14. GemsA gem is a packaged Ruby application or library. It has a name (e.g. rails)and a version (e.g. 3.2.1).Examples:OmniAuthOmniAuth is a Ruby authentication framework that provides a standardized interface to many differentauthentication providers such as Facebook, OpenID, and even traditional username and password.CarrierWaveUpload files in your Ruby applications, map them to a range of ORMs, store them on different backends. It workswell with Rack based web applications, such as Ruby on Rails.Active MerchantActive Merchant is an extraction from the e-commerce system Shopify. Shopify’s requirements for a simple andunified API to access dozens of different payment gateways with very different internal APIs was the chief principlein designing the library. It was developed for usage in Ruby on Rails web applications and integrates seamlessly asa plugin but it also works excellently as a stand alone library.Friday, 17 May 13

×