# chap 4

## Rails: ActiveModel, ActiveRecord and ActiveResource

```
ActiveModel + Database Support = ActiveRecord

ActiveModel via WebService API = AcitveResource
```

**ActiveModel**: all the model related without db. (Ex: validations).

**ActiveRecord**: associates a class to the database. (Ex: find method).

**ActiveResource**: Similar to ActiveRecord. However, instead of being backed by a database, an ActiveResource object is backed by another application through a web service API.

## Rails: Action Pack

```
Action Pack: From request to response -> provides the view and controller layers.
|
|- Action Dispatch: parses request, handles routing, cookies and sessions.
|- Action Controller
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://huang-jason.gitbook.io/ruby-rails-syntax/chap_4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
