Skip to content

Instantly share code, notes, and snippets.

@twopoint718
Created June 9, 2023 21:28
Show Gist options
  • Save twopoint718/0093819a959fb0be1d1589fd86746299 to your computer and use it in GitHub Desktop.
Save twopoint718/0093819a959fb0be1d1589fd86746299 to your computer and use it in GitHub Desktop.
Single-file Rails application
# Run with:
# $ rackup app.ru
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '~> 7.0.5'
gem 'puma'
end
require 'action_controller/railtie'
class App < Rails::Application
config.root = __dir__
config.consider_all_requests_local = true
config.secret_key_base = SecureRandom.hex
config.eager_load = false
routes.append do
root to: 'welcome#index'
end
end
class WelcomeController < ActionController::Base
def index
render inline: 'Hello'
end
end
App.initialize!
run App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment