Advertisement
kn0tsel

Ruby-05

May 12th, 2013
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 2.1 The MVC Architecture
  2.  
  3. Rails is organized around the Model, View, Controller architecture, usually just called MVC.
  4. MVC benefits include:
  5.     Isolation of business logic from the user interface
  6.     Ease of keeping code DRY
  7.     Making it clear where different types of code belong for easier maintenance
  8.  
  9. 2.1.1 Models
  10. A model represents the information (data) of the application and the rules to manipulate that data. In the case of Rails, models are primarily used for managing the rules of interaction with a corresponding database table. In most cases, one table in your database will correspond to one model in your application. The bulk of your application’s business logic will be concentrated in the models.
  11.  
  12. 2.1.2 Views
  13. Views represent the user interface of your application. In Rails, views are often HTML files with embedded Ruby code that performs tasks related solely to the presentation of the data. Views handle the job of providing data to the web browser or other tool that is used to make requests from your application.
  14.  
  15. 2.1.3 Controllers
  16. Controllers provide the “glue” between models and views. In Rails, controllers are responsible for processing the incoming requests from the web browser, interrogating the models for data, and passing that data on to the views for presentation.
  17.  
  18. 2.2 The Components of Rails
  19.  
  20. Rails provides a full stack of components for creating web applications, including:
  21.     Action Controller
  22.     Action View
  23.     Active Record
  24.     Action Mailer
  25.     Active Resource
  26.     Railties
  27.     Active Support
  28.  
  29. 2.2.1 Action Controller
  30. Action Controller is the component that manages the controllers in a Rails application. The Action Controller framework processes incoming requests to a Rails application, extracts parameters, and dispatches them to the intended action. Services provided by Action Controller include session management, template rendering, and redirect management.
  31.  
  32. 2.2.2 Action View
  33. Action View manages the views of your Rails application. It can create both HTML and XML output by default. Action View manages rendering templates, including nested and partial templates, and includes built-in AJAX support.
  34.  
  35. 2.2.3 Active Record
  36. Active Record is the base for the models in a Rails application. It provides database independence, basic CRUD functionality, advanced finding capabilities, and the ability to relate models to one another, among other services.
  37.  
  38. 2.2.4 Action Mailer
  39. Action Mailer is a framework for building e-mail services. You can use Action Mailer to send emails based on flexible templates, or to receive and process incoming email.
  40.  
  41. 2.2.5 Active Resource
  42. Active Resource provides a framework for managing the connection between business objects an RESTful web services. It implements a way to map web-based resources to local objects with CRUD semantics.
  43.  
  44. 2.2.6 Railties
  45. Railties is the core Rails code that builds new Rails applications and glues the various frameworks together in any Rails application.
  46.  
  47. 2.2.7 Active Support
  48. Active Support is an extensive collection of utility classes and standard Ruby library extensions that are used in the Rails, both by the core code and by your applications.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement