HOW TO: CREATE A RAILS APP
1. install ruby on rails
follow the official instructions for installing ruby on rails:
guides.rubyonrails.org/install_ruby_on_rails.html#choose-your-operating-system
2. install postgresql packages
using postgresql in ruby requires you to have postgresql installed on your system. you will need to install the server, client, and development header packages. if they are not installed, bundle install
will fail when setting up the project and you won't be able to create a database.
-
ubuntu:
sudo apt install postgresql postgresql-contrib libpq-dev
-
macos:
brew install postgresql
brew services start postgresql
3. create your rails project
follow the official instructions for creating a new rails project:
guides.rubyonrails.org/getting_started.html#creating-a-new-rails-app
-
important: in the command to create the app, add the flag:
--database=postgresql
and use the actual name of your app! if you change your mind later, this can be changed, it's just a little bit of unnecessary manual work
-
example:
rails new your_app_name_here --database=postgresql