<commit_before># Action Text

🤸‍♂️💰📝

## Installing

Assumes a Rails 5.2+ application with Active Storage and Webpacker installed.

1. Install the gem:

    ```ruby
    # Gemfile
    gem "actiontext", github: "basecamp/actiontext", require: "action_text"
    gem "image_processing", "~> 1.2" # for Active Storage variants
    ```
   
1. Install the npm package:

    ```js
    // package.json
    "dependencies": {
      "actiontext": "basecamp/actiontext"
    }
    ```
    
    ```sh
    $ yarn install
    ```
    
    ```js
    // app/javascript/packs/application.js
    import "actiontext"
    ```

1. Migrate the database

   ```
   ./bin/rails action_text:install
   ./bin/rails db:migrate
   ```

1. Declare text columns as Action Text attributes:

    ```ruby
    # app/models/message.rb
    class Message < ActiveRecord::Base
      has_rich_text :content
    end
    ```

1. Replace form `text_area`s with `rich_text_area`s:

    ```erb
    <%# app/views/messages/_form.html.erb %>
    <%= form_with(model: message) do |form| %>
      …
      <div class="field">
        <%= form.label :content %>
        <%= form.rich_text_area :content %>
      </div>
      …
    <% end %>
    ```
<commit_msg>Update instructions to get the local version of actiontext<commit_after># Action Text

🤸‍♂️💰📝

## Installing

Assumes a Rails 5.2+ application with Active Storage and Webpacker installed.

1. Install the gem:

    ```ruby
    # Gemfile
    gem "actiontext", github: "basecamp/actiontext", require: "action_text"
    gem "image_processing", "~> 1.2" # for Active Storage variants
    ```
   
1. Install the npm package (with a local reference to this checked out repository):

    ```sh
    $ yarn add file:../actiontext
    ```
    
    ```js
    // app/javascript/packs/application.js
    import "actiontext"
    ```

1. Migrate the database

   ```
   ./bin/rails action_text:install
   ./bin/rails db:migrate
   ```

1. Declare text columns as Action Text attributes:

    ```ruby
    # app/models/message.rb
    class Message < ActiveRecord::Base
      has_rich_text :content
    end
    ```

1. Replace form `text_area`s with `rich_text_area`s:

    ```erb
    <%# app/views/messages/_form.html.erb %>
    <%= form_with(model: message) do |form| %>
      …
      <div class="field">
        <%= form.label :content %>
        <%= form.rich_text_area :content %>
      </div>
      …
    <% end %>
    ```

{'fraction_non_alphanumeric': 0.14149772445179976, 'fraction_numerical': 0.007447248655357882, 'mean_word_length': 2.454285714285714, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 19, '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': '994028', 'n_tokens_mistral': 845, 'n_tokens_neox': 795, 'n_words': 209}