Create your first Rails Application

What is Rails ?

How to setup the computer for Rails

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.3.0
rbenv global 2.3.0
ruby -v
My PC ruby version
gem install bundler
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
gem install rails -v 4.2.3
rbenv rehash

Let’s create the first application

      version     name of the application
rails _4.2.3_ new myapp
rails _version_ new AppName -d DB_TYPErails _4.2.3_ new MyFirstApp -d mysql
cd MyFirstApp
bundle install
Bundle complete! 12 Gemfile dependencies, 61 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
atom .
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
database: MyFirstApp_development
test:
<<: *default
database: MyFirstApp_test
production:
<<: *default
database: MyFirstApp_production
username: MyFirstApp
password: <%= ENV['MYFIRSTAPP_DATABASE_PASSWORD'] %>
rails serverorrails s
localhost:3000

--

--

Developer ❤️ JS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store