Generating a New Rails Application

In the terminal:

rails new blog-flash

You’ll need to add the name of your application after “rails new”

Set Your Domain Model and Build Schema

By this point, you should have your domain models & attributes planned. Now it’s time to set that all up.

We all love shortcuts. Luckily for us, rails gives some really convenient generators to set up your database through a few lines in the terminal.

Create Migration Table:

In the terminal:

In terminal: rails g migration create_coupons coupon_code:string store:string#Creates file under db/migrater#=> 20201117213427_create_coupons.rb

This action creates a file under your database library in the migrate folder. It will timestamp it and add the name of your file. This will create the class, set up the inheritance needed from ActiveRecord, and create a method with your attribute columns. …


If you’re learning Ruby, you’ve come across some helpful tools to help write your logic called Enumerable’s. What’s an Enumerable? Basically Ruby’s special toolbox filled with a bunch of methods for traversal, searching and sorting through array’s or hashes. You can liken Ruby’s toolbox to any regular toolbox with a flathead & phillips screwdriver, a hammer, a saw, etc.

Let’s say you need to put a screw in the wall to hang a painting. What tool in your toolbox will you use?

First, you’ll need to decide what kind of screw is going in the wall. After looking at the screw, it looks like you got one with a phillips head top. Okay, great. Let’s go with the phillips head screwdriver to screw that in the wall. And as expected, went in easy. …

About

Kevin Botero

This is my bio.

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