<commit_before>positron
========

This gem is designed to help separate ActiveRecord (as an implementation detail) from other objects in a Rails MVC application. It should (eventually) also work with other frameworks and ORMs. Its purpose is twofold:
* provide an airtight way of preventing the view from touching the database
* avoid exposing the entire ActiveRecord public interface in every model class (persistence is an implementation detail, not something callers have to know about)

How and why does it do that? Read on!

## Rails MVC basics, or the stuff you already know

In a well-designed Rails (or similar MVC) application, the view should never touch the database. Rather, all data should be marshalled through the controller, and the view is generally restricted to calling simple accessor-type methods on the model and displaying the results. So you'd never write `User.find(params[:id]).name` in the view; instead, a typical Rails application looks like this:

```ruby
# app/models/user.rb
class User < ActiveRecord::Base
  # DB columns include name, address, etc.
end
```

```ruby
# app/controllers/users_controller.rb
class UsersController < ApplicationController
  def show
    @user = User.find params[:id]
  end
end
```

```haml
# app/views/users/show.html.haml<commit_msg>Fix Haml comment syntax.<commit_after>positron
========

This gem is designed to help separate ActiveRecord (as an implementation detail) from other objects in a Rails MVC application. It should (eventually) also work with other frameworks and ORMs. Its purpose is twofold:
* provide an airtight way of preventing the view from touching the database
* avoid exposing the entire ActiveRecord public interface in every model class (persistence is an implementation detail, not something callers have to know about)

How and why does it do that? Read on!

## Rails MVC basics, or the stuff you already know

In a well-designed Rails (or similar MVC) application, the view should never touch the database. Rather, all data should be marshalled through the controller, and the view is generally restricted to calling simple accessor-type methods on the model and displaying the results. So you'd never write `User.find(params[:id]).name` in the view; instead, a typical Rails application looks like this:

```ruby
# app/models/user.rb
class User < ActiveRecord::Base
  # DB columns include name, address, etc.
end
```

```ruby
# app/controllers/users_controller.rb
class UsersController < ApplicationController
  def show
    @user = User.find params[:id]
  end
end
```

```haml
/ app/views/users/show.html.haml
{'fraction_non_alphanumeric': 0.0718954248366013, 'fraction_numerical': 0.0, 'mean_word_length': 4.782222222222222, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3121737', 'n_tokens_mistral': 689, 'n_tokens_neox': 646, 'n_words': 346}