This site runs best with JavaScript enabled.

What Are Symbols in Ruby on Rails?

What is a symbol in Ruby? The syntax for symbols is a colon then a word :symbol In Ruby on Rails it's common for symbols to be used to identify methods, instance varibles and hash keys For example user is refering to the @user instance variable that get created when you create a new user. The…

Read Article →

What Are Instance Variables in Ruby on Rails?

In Ruby instance variables start with the @ sign If you create a variable inside of a class, it's not available to every method in that class. In order to access the contents of batman outside of my_name you put the @ sign in front of it. Ruby on Rails takes this a step futher and allows…

Read Article →

What Is Embedded Ruby?

Embedded Ruby aka ERb. is a templating system that Ruby on Rails uses to show dynamic content on your website. ERb files end in a .html.erb or .erb file type. You can write HTML and plain Ruby inside of ERb files. In order to use Ruby you have to place your Ruby code inside this tag. Inside this tag…

Read Article →

What are helpers in Ruby on Rails

In Ruby on Rails helpers are methods that let you have reuseable code that can be used in different the views of your app. Rails has some built-in helpers like stylesheet_link_tag to link to the CSS file you want to use. You can place the helper in your view by placing it's name in between the…

Read Article →

Intro to CSS Variables

In CSS you can use variables to store information and reference it later in your app using the variable name. This make writing CSS a lot easier, because it cuts down on having to type the same things over and over when you need to make changes in multiple places. Declaring CSS variables You can…

Read Article →

🗂️ Create a model in Ruby on Rails

To store data in Ruby on Rails you use a model (The M in MVC). Models communicate with the database of the site. To make a model with the attributes of name and email in the command line type Notice that the User model is singular. There are two optional parameters, name:string and email…

Read Article →

Ruby on Rails Basics Make Your First Rails Resource

Ruby on Rails is very powerful framework even more powerful than I thought. When I created my first resource using a feature called scaffolding it was so easy I wasn't actually sure what I did. So I'm going to demystify what happens when you create a resource. A resource is something that users can…

Read Article →

Join the Newsletter

Will Johnson © 2020