AI
Trying to work with AI to create a ruby on rails comment system.
- Use google ai studio, gemini 2.5 pro, turn on grounding. Discuss about the project, generate a PRD(Product Requirement Document).
- Use VSCode insider with github copilor student free tier. Use ask mode. Feed it the PRD. It responds with a suggestion of file structure. Tell it I want to create it by hand.
- it says:
rails new comment-system-api --api --database=postgresql
cd comment-system-api
Search online, find the ruby on rails documentation The Rails Command Line .
Install ruby on rails via nix-darwin. Seems not good. Read some resources:
Attempt #1
gem install rails
Don’t worry, that’s a joke.
- https://kristianfreeman.com/running-a-ruby-on-rails-application-in-nix
- https://nixos.org/manual/nixpkgs/stable/#developing-with-ruby
I’ve spend one month on NixOS and didn’t get the input method/xwayland/niri/waybar work as I expected. Maybe it is not wise to dig in “how to install rails use Nix” instead of create the product I need right now. I should focus on build.
Let’s just gem install rails
.
Nah, it doesn’t work. Follow the official install_ruby_on_rails , we could use…
Wow!
Install these with nix openssl_3 libyaml gmp rustc
Official mise guide is ambigious.
Searched on Github, trying to follow example by skyblue-jpn to install mise with nix.
Add mise-flake.url = "github:jdx/mise";
to flake.nix inputs and outputs=inputs@.
It works! Wait… mise is just for install ruby, not rails. It also use bundle to handle rails.
Back to start.
I have devenv installed. Maybe try to use it.
- https://upsun.com/blog/how-to-start-a-ruby-on-rails-project-with-devenv.sh/
- https://github.com/cachix/devenv/blob/main/examples/ruby/devenv.nix
- https://github.com/cachix/devenv/blob/main/examples/rubyonrails/devenv.nix
- https://discourse.nixos.org/t/issue-running-tailwind-css-with-rails-on-nixos-devenv-sh-setup/63261
Maybe this is not a good idea, the scaffold is too complex. Docker might be better.
Decide to use nix-shell to install temporary rails, and create the project with docker. Then use that docker to work on the project.
# start the nix-shell
nix-shell -p git curl openssl_3 libyaml postgresql bundler ruby_3_4.withPackages'(ps: [ps.rails])'
# check ruby version
ruby --version
# check rails version
rails --version
# https://guides.rubyonrails.org/command_line.html#creating-a-rails-app
rails new --help
# Let's create it!
# https://supabase.com/docs/guides/getting-started/quickstarts/ruby-on-rails
rails new rails-comment --database=postgresql
Successfully created the project, but the dockerfile says it is for production, not development.
Install docker the non-nix way .
I installed orbstack . But maybe nothing to do with it yet?
I asked github copilot claude 3.7, created dockerfile.dev, dockerfile.prod, docker-compose.yml
And decided to use postgresql image as the database for now. It might be easier for development localy.
And use these commands:
# run the docker container
docker-compose up
# stop the docker container
docker-compose down
# build it without cache when debugging
docker-compose build --no-cache
It’s working!
Rails version: 7.2.2.1
Rack version: 3.1.13
Ruby version: ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +YJIT +PRISM [aarch64-linux]