How did you install rails? Did you usual one of the development guides? (like Beginners Guide to Install Discourse on Ubuntu for Development)
There are some howto documents for running the install script inside the production container (what I usually do), so you might use one of those for a guide.