Let's check in with each other... (hope you're sitting down for this)
Just a heads up on what you'll be asked to do at the end of the week.
Follow these steps to get Ruby on Rails set up on your computer
Make sure you have Rails 5, Ruby 2, Sublime Text, and your command line ready before moving on.
The command line can be a scary place for beginners, but there are only a handful of commands you'll need to know in order to use it.
I'm going to show you how to create a new Ruby on Rails application
Git lets you save different versions of your files to make it easier to work with a team, or to go back to previous saves.
Updating .gitignore lets you ignore certain files you don't want Git to track
I'll show you how to do something really useful with Git: go back to your last save
What if you made a mistake and wanted to rename your entire application? It's actually pretty easy.
Let's use git to get your code up on Github
One of the first things you'll want to do in a brand new Rails app is replace the default homepage with one of your own
Setting your root path means changing what page people see when they go to your homepage
You'll need more than just a homepage if you want to build a real web application
Embedded Ruby (ERB) lets you write Ruby code inside your web pages
By moving our links into the application layout, we can avoid duplication of code
We're done for the week, let's save and push our changes to Github
Your assignment for this week...
Bootstrap is a front-end framework that every beginner should use. It's really easy to install with a simple gem.
Remember, ABC: Always Be Committing.
Here are some templates you can use.
How do you move your app live so that others can see it? With a great service called Heroku that lets your deploy your app to the web in seconds.
What to do in case you run into problems with Heroku
Devise is one of the most popular user authentication gems for Rails.
Here I show you how to set up Devise so it works properly inside of our app.
Use Devise to create a user model and migrate those changes into your database.
Devise automatically creates new pages in our app for signing up and signing in.
With the new functionality, we can create a page that users can only see once they've signed in successfully.
A link in the navbar lets users log out of their account.
Of course you'll also want to add links so that users can sign up and sign in again later.
Devise's default routes can be customized so we can use our own path names in our links.
Go into your views to override the default Devise sign up and sign in pages with your own HTML code.
Now to make sure it all works on Heroku too.
A small change will make our app work again on Heroku.
Customize some Bootstrap variables and share your Heroku URL.
I'll show you how to add new Syntax Highlighting and other features to Sublime Text using Package Control.
Registering and setting up a custom domain with Heroku is easy! I'll show you how.
We'll be using a gem called ActiveAdmin to set up our admin area
We need to be able to see what users signed up in our admin area
Lock down your admin area to admins only using these simple steps
We're basically adding a new field to users that keeps track of whether they're an admin or not
I show you a few important steps you can take in case you mess up migrations
How to solve the puzzle of creating your first admin user
Here's what we've done (double check to make sure your changes match before moving on)
I show you how to do some slight tweaking to ActiveAdmin views
Let's finally get this thing live (and test to make sure it works)!
What is this magical scaffold thing?
Let's get a better understanding of what we just did
Okay, stay with me...
What routes did our new tweets create?
Let's try to undesrtand the new tweets controller
Finally we'll take a look at our new tweet views
Tweets are nothing without users
We'll use the handy current_user method to create our tweets
So we can control them in there
We don't want all users to see the links that we currently have, so how do we hide them?
We can block certain actions and force people to log in to access them
Let's do another git commit and push so that we don't lose our changes
Here's where things get real. You'll need to create a new resource for your app.
Already have an account?