A Potential New Rails Generator: rails g feature with OpenAI Integration

Hello Rails Community,

I’m collecting feedback for a new potential generator in Rails applications. Imagine a Rails generator that leverages the power of the OpenAI (or other LLM) API to create all the necessary files and boilerplate code for a new feature, based on a simple prompt you provide. This is the core concept behind a proposed new generator: rails g feature.

The Concept

The idea is to create a rails g feature generator that allows developers to describe a feature they wish to implement using natural language. For example, you might provide a prompt like:

rails g feature "Create a feature for managing tasks in a Rails application. This should include a Task model with attributes: title (string), description (text), due_date (datetime), and completed (boolean). Generate a TasksController with standard CRUD actions and corresponding views for index, show, new, edit, and a form partial. Also, update the routes to include resources for tasks."

The generator would then use the OpenAI API to process this prompt and generate all the necessary files and code, including:

  • Model definitions
  • Migrations
  • Controllers with CRUD actions
  • Views for different actions (index, show, new, edit)
  • Routes configuration
  • Form partials

Seeking Your Input

Do you know of any similar idea/project in the making. I would like your input to refine the idea and potentially get started on coding a minimal version.

1 Like