
April 15, 2025
π’ I just released a new version of my Rails engine and gem: TrixGenius! This gem extends the beloved Trix Editor with some fresh, AI-powered superpowers β all using Hotwire (Turbo + Stimulus).
Whether you’re building internal tools, CMS interfaces, or AI-enhanced content platforms, TrixGenius gives your rich text editor a serious productivity boost.

β¨ Whatβs New in Alpha 0.1.2?
This update introduces a brand-new feature that Iβm super excited about:
β Calculate Math Expressions with a Single Click!
Users can now type math expressions inside the Trix editor (like (5 + 3 * 2)), hit the new βCalculateβ button, and automatically get the result injected back into the content.
π§ Under the hood:
- Detects top-level math expressions in parentheses.
- Uses a secure Ruby evaluator to compute results (e.g., (3+4*2) becomes 3+4*2=11).
- Optionally calls an AI (e.g., DeepSeek) to reformat the text while preserving the original context.
π₯ Hereβs what it looks like:
Input: Letβs compute (8/2+3*2).
Result after clicking βCalculateβ: Letβs compute 8/2+3*2=10.
πΌ Need Help Building AI-Powered Tools in Rails?
If you’re looking to enhance your Rails app with AI, improve your editor experience, or just want someone to help you ship smarter features faster β Iβd love to chat.
I specialize in:
- π Ruby on Rails development
- π§ AI integrations (OpenAI, DeepSeek, custom APIs)
- β‘ Hotwire (Turbo + Stimulus)
- π οΈ Building and maintaining custom gems and engines
π Letβs connect: rubystacknews.com/get-in-touch
Happy to explore how we can build something great together. π
π§ How it Works β Under the Hood
The magic happens through:
β A Stimulus Controller
- Adds a “Calculate” button to the Trix toolbar.
- Collects the editor content.
- Sends it via AJAX to your Rails backend for evaluation.
β A Rails Endpoint (/trix_genius/calculate_expression)
- Securely parses and evaluates expressions.
- Integrates optional AI enhancement.
- Returns transformed HTML content.
β Generator Updates
The gem now automatically injects this route:
# TrixGenius: Auto-added route post "/trix_genius/correct_spelling", to: "trix_genius#correct_spelling"
Itβs all scaffolded into your app with a single command:
bin/rails g trix_genius:install
π§ͺ Still in Alpha β But Growing Fast

This gem started with a simple idea: make Trix smarter. The first feature was a “Correct Spelling” button. Now, weβve added math evaluation, and weβre already working on:
- Integrating ChatGPT & Qwen.ai
- Feature toggles (enable/disable toolbar buttons)
- Specs for all features
π Try It Out
You can install the gem from RubyGems:
gem 'trix-genius', '~> 0.1.2'
Then run the install generator:
bundle install bin/rails g trix_genius:install
Demo it with Action Text + a simple scaffold:
bin/rails g scaffold Post title:string content:rich_text


π Feedback Welcome
This is an early release, and Iβd love to hear what you think β feature requests, issues, and ideas are more than welcome.
Feel free to reach out or follow the repo to stay updated: π https://github.com/ggerman/trix_genius
Letβs build smarter content tools for Rails devs! π§π‘
#RubyOnRails #Hotwire #TrixEditor #StimulusJS #AI #OpenSource #DevTools #RubyGems

One thought on “π Introducing TrixGenius Alpha 0.1.2 β Now with AI-Powered Math Evaluation!”