Getting started Ruby on Rails 5

Generate a rails app:

rails new <app-name> -d <database>rails new test-app -d mysql (default:sqllite)

Basic Configurations:

bundle install

App-level config:

# Application configuration should go into files in config/initializersi.e :config/initializers

DB-Configuration: (database.yml)

CREATE DATABASE test-app_development;CREATE DATABASE test-app_test;GRANT ALL PRIVILEGES ON test-app_development.* To 'rails_user'@'localhost' IDENTIFIED By '<password>';GRANT ALL PRIVILEGES ON test-app_test.* To 'rails_user'@'localhost' IDENTIFIED By '<password>';
rails db:schema:dump

Model View Controller:

MVC: burger store
  • Assets: Images, CSS, javascript
  • Channels: Action Channels
  • Controllers
  • Helpers: View helpers
  • Jobs: Like Cron
  • Mailer: Sending emails
  • Model
  • Views

Start a Web-Server: for development (puma-server)

rails server or rails s
//issue with openssl gem install puma -- --with-opt-dir=/usr/local/bin/openssl (location of openssl installation)
rails g
rails generate controller BurgerController BurgerView

Routing :

Photo by Michał Parzuchowski on Unsplash
  • Simple
  • Default
  • Root
  • Resourceful (restful): for rest service
Rails.application.routes.draw doget 'burger_controller/BurgerView'# For details on the DSL available within this file, see
class BurgerControllerController < ApplicationControllerlayout falsedef BurgerView
@burgerList = ['Cheese-Burger', 'Bacon Burgers', 'Green-Chile Burgers']
<p>Find me in app/views/burger_controller/BurgerView.html.erb</p>
<% @burgerList.each do |n| %>
<%= n %> <br />
<% end %>
Burger View

#redhatter #opensource #developer #kubernetes #keycloak #golang #openshift #quarkus #spring

Love podcasts or audiobooks? Learn on the go with our new app.

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
Abhishek koserwal

Abhishek koserwal

#redhatter #opensource #developer #kubernetes #keycloak #golang #openshift #quarkus #spring

More from Medium

Ruby on Rails Action Mailer Configuration

Bubble sort with array in ruby

How to use Active Record in Sinatra (RUBY)