Duration: 1h 05m | On demand
Ruby on Rails has powered some of the world’s most successful startups and continues to be one of the most productive frameworks for building scalable web applications.
In this webinar, Luis Payan], Senior Software Engineer at BEON.tech, breaks down how Ruby on Rails works in practice, step by step, from understanding MVC architecture to building and deploying a real-world application.
🎥 Watch the Full Webinar
Prefer to watch? The complete session is above.
Prefer to read and go deeper into each concept? Keep scrolling.
What You’ll Learn
By the end, you’ll understand how to:
- Generate embeddings and store them in PostgreSQL using pgvector
- Implement semantic search by comparing vector similarity
- Run embedding generation asynchronously using Rails background jobs
- Build a real-time streaming assistant using Action Cable
- Stream model responses chunk-by-chunk into the UI
- Generate dynamic CSV reports using AI-generated SQL
- Reuse the embedding logic across models using Rails concerns
The goal is not just to define Ruby on Rails, but to show how it fits into real production environments and how you can start building with it yourself.
Rails in the Age of AI
There’s a common misconception that Rails is falling behind in the AI era.
In reality, most AI features are integrations: API calls, background jobs, database operations, and real-time updates. Rails excels at structured backend workflows and rapid development.
Instead of replacing Rails, the opportunity is to enhance it.
This webinar demonstrates how.
Feature 1: Semantic Product Search
(Embeddings + pgvector)
Traditional ecommerce search relies on filters and keyword matching. As product catalogs grow, users spend more time configuring filters than finding what they need.
Semantic search improves this experience by matching meaning instead of keywords.
For example:
- “Show me stuff related to sports”
- “Things you’d put in a bedroom”
Instead of exact matches, the system compares vector representations of text.
How Semantic Search Works
The workflow:
- Convert product text into embeddings
- Store embeddings in PostgreSQL using pgvector
- Convert the user query into an embedding
- Compare vectors using similarity operators
- Return the closest matches
Each product generates a semantic context using:
- Name
- Description
- Tags
Because embedding generation can be slow at scale, the demo runs this process asynchronously using Rails background jobs.
This keeps the user experience responsive.
Making Embeddings Reusable with Rails Concerns
In real applications, multiple models may require embeddings: Products, Posts, FAQs, etc.
Instead of duplicating logic, the webinar shows how to extract embedding behavior into a Rails concern.
This allows you to:
- Centralize embedding generation
- Standardize context building
- Reuse functionality across models
This keeps the system maintainable as the schema grows.
Feature 2: AI Product Assistant
(Streaming Chat with Action Cable)
The second feature is a ChatGPT-style assistant embedded in a product page.
Users can ask natural-language questions like:
“Can you compare this car with the most popular brands?”
Real-Time Streaming Architecture
The system works as follows:
- The user sends a message
- Rails forwards it to the language model
- The model streams the response incrementally
- Rails broadcasts chunks via Action Cable
- The frontend appends chunks in real time
Instead of waiting for a full response, the UI updates as text is generated.
This creates a responsive, modern experience using Rails-native tools (Hotwire and Stimulus).
Feature 3: Dynamic Report Generator
(AI → SQL → CSV)
The third feature allows users to generate reports using natural language prompts.
Example:
“Show total products sold, add quantity per order by each user, and include all user info.”
How the Report Generator Works
- The user submits a request
- Rails sends the prompt plus database context to the model
- The model generates SQL
- Rails executes the SQL
- Rails generates a CSV in memory
- The file is sent directly to the browser
Rails supports raw SQL execution when needed and allows CSV streaming without storing files on the server.
Security Considerations
Generating SQL with AI introduces risk.
In production environments, you should:
- Use a read-only database user
- Restrict allowed query types
- Validate AI-generated output
- Block destructive statements
- Limit accessible tables
- Protect the feature with strict authorization
AI integration requires architectural boundaries, not blind execution.
Key Takeaways
Rails remains one of the fastest ways to ship structured web applications, even in the age of AI.
This webinar demonstrates that you can:
- Implement semantic search with embeddings and pgvector
- Build real-time AI assistants with Action Cable
- Generate dynamic reports using AI-powered SQL
- Integrate modern AI features without changing your stack
The goal is not to chase trends, but to leverage Rails’ strengths to deliver modern capabilities.
FAQs
What if users make typos in semantic search?
You can improve prompts, preprocess input, and handle “no results” gracefully.
Is semantic search better than Elasticsearch?
They solve different problems. Elasticsearch excels at keyword filtering. Embeddings excel at meaning-based retrieval. Many teams combine both.
Does Rails prevent prompt injection?
Rails prevents SQL injection when parameterized correctly. Prompt injection requires output validation and strict execution boundaries.
Do I need Ollama for this setup?
No. Ollama is used in the demo for local development. Any provider with embedding and chat APIs can work.