Scenes from my first week using Rails

We did Rails this week in Makers.

Here’s a short look at some of my experiences going through basic set up.


$rails new yelp_clone -d postgresql -T

Woah. Where did all the files come from? What’s going on here?


$rake db:create

Ha, I didn’t even create a Rakefile or tell it what name to call the database and it just did it. This is weird. There’s nothing in the model. What’s in the database?


#config/routes.rb
resources :restaurants

and then.

$rake routes

And that’s my controller done? No, I don’t even have a controller yet. But the routes are done. What the hell is going on?


rails g controller restaurants

Alright, so now we have an empty controller. But the routes don’t go in here so what the hell does?


At least making the views is the same as Sinatra. Some degree of consistency in a world gone made eh?


rails g model restaurant name:string rating:integer

So this builds my model and adds everything to database? That’s pretty cool.


#Gemfile
gem ‘devise’

and install it.

$bundle
$rails g devise:install
$rails g devise User

Alright, this is seriously good stuff. All my user sign up/in/out routes and authentication done. Alright I’m digging this now.


Bottom line. No need to be scared of Rails. Also don’t listen too much to the rest of the world’s opinion on it (everyone seems to have one).

It’s a framework that does some pretty handy stuff for you. It’s not the be all and end all, its not black magic (though it can seem that way) and its certainly worth experimenting with.

This is part of my daily blog series while I attend Makers Academy coding bootcamp. If you’d like to read more you can find them here.

Makers Academy Week7 Day5

Show your support

Clapping shows how much you appreciated Kevin McCarthy’s story.