Rails Kids

What is

Ruby on Rails?

 

Ruby on Rails is an open-source web framework built on the Ruby programming language.

 

It lets you write beautiful code by favouring convention over configuration.

 

Like many web frameworks, Ruby on Rails uses the model–view–controller (MVC) pattern to organize application programming.

What is Ruby

A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

# Output "I love Ruby"
say = "I love Ruby"
puts say

# Output "I *LOVE* RUBY"
say['love'] = "*love*"
puts say.upcase

# Output "I *love* Ruby"
# five times
5.times { puts say }

What is Rails is for?

Ruby on Rails is used for build web applications.

 

Unlike web sites, web applications are dynamic and often take users input to form the content.

 

Unlike traditional software a user only requires a web

browser to access a web application.

Lets try some ruby!

http://tryruby.org/

Creating the application

What is MVC ?

Model

View

Post.first.created_at
# => 2015-01-10 18:21:27
<p>
  <em><%= post.time_ago_in_words %></em>
</p>

Controller

Rails Scaffolding

Rails scaffolding is a quick way to generate some of the major pieces of an application.

 

If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.

 

Lets build our first application!

http://is.gd/railskids

Commands

Migrations

Migrations are a convenient way to alter your database over time in a consistent and easy way.

 

You can think of each migration as being a new 'version' of the database.

 

What is ERB?

Embedded RuBy

<% print(2 + 3) %>

<%= 2 + 3 %>
<% @ideas.each do |idea| %>
  <h2><%= idea.title %></h2>
  <p><%= idea.description %></p>
<% end %>

What is a Gem ?

A gem is a Ruby library or program packaged in a standard format for easy distribution.

 

Most Ruby projects use a Gemfile to list all of the libraries you want to use in a project.

 

Examples of Gems

DEVISE - User authentication made easy

DELAYEDJOB - Run code at a scheduled time

ActiveAdmin - A CMS for your Rails application

What is a Open Source software ?

Open source software is software whose source code is available for modification or enhancement by anyone.

 

You can find many examples of Open Source software available on GitHub.

 

What next ?

Rails Kids

By Adam Butler

Rails Kids

  • 1,141
Loading comments...

More from Adam Butler