Ruby On Rails Architecture

Layer and Component

Active Record

Concept

  • Table to Class Mapping
    • Each table is mapped to one or more classes
    • getters and setters
  • Database Connectivity
    • config/database.yml
  • CRUD Operations
    • find()
  • Data Validation
    • validate_on_create() and validate_on_update()

Create a model object from a table,

ruby script/generate model Tale

Action View

Concept

  • Templates
    • rhtml
  • Form Helper
    • start placing the element methods in the form of form_tag().
  • Formatting Helper
    • date, currency, and string
  • Layout
    • Layout API
    • nesting different pages
    • a header, body, and footer

Example

<html>
<head>
<title>Select Date</title>
</head>
<body>
<h3> Please select the date of the publication of the
Tale</h1>
date_select("post", "written_on", :start_year => 1855)
</body>
</html>

Action Controller

Concept

  • Session Handling
    • session object
  • Filtering
    • logging, user authentication and personalized response
    • before, after, and around
  • Caching

Example

ruby script/generate controller AddTale