Coding Kickstarter

WIFI: CoderFactory
PASSWORD: BSf111ee

Created by Coder Factory / @coderfactory / Facebook page / Github

Presented by Peter Argent / @pedrogrande

bit.ly/coding-kickstarter

http://thecoderfactory.github.io/free-get-started-with-rails-workshop

Welcome to Ruby on Rails

Agenda

  1. Introductions
  2. Why learn to code?
  3. What is Ruby on Rails
  4. A quick demo
  5. The development environment
  6. Create your first Rails web application
  7. Resources to learn more

Why learn to code?

Learning to code, changes your life.

Once you know how to build apps with code, a whole new world of possibilities open up for you and you will never look back.


How you will feel

  • Overwhelmed
  • Confused
  • Frustrated
  • Annoyed
  • Surprised
  • Excited
  • Amazed
  • Joyous

What is Ruby on Rails?

"Ruby on Rails is an open-source web application framework that is optimised for developer happiness and sustainable productivity. It's lets you write beautiful code by favouring convention over configuration."

Rubyonrails.org


Ruby

Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan.

http://en.wikipedia.org/wiki/Ruby_(programming_language)

Rails

David Heinemeier Hansson (DHH) extracted Ruby on Rails from his work on Basecamp, a project management tool by 37signals.

It was first released as open source in July 2004.

Web application framework

A software framework that is designed to support the development of dynamic websites, web applications, web services and web resources.

Frameworks provide libraries for database access, templating frameworks and session management, and they often promote code reuse.

A quick demo

Witness the amazingness of Rails!

The development environment

A development environment is the set of tools and software a developer uses when creating software.

For Ruby on Rails development:

  1. Interpreter - Ruby language interpreter - terminal
  2. Text editor - to edit the code
  3. Local server - web and database servers
  4. Browser - to view application

Nitrous

Today we're going to use Nitrous.io to create a web application with Ruby on Rails.

Sign up for an account - it's free!

Setup your environment

Mac: Mac

Windows: Windows


Download a text editor. I recommend Github's Atom.

Create your first application

1. Open your terminal or command prompt.

In Mac: Press Cmd + Spacebar, type terminal and hit enter.

In Windows: Start button, type cmd and hit enter.

2. Create a new directory for your apps.

In your terminal/command prompt, type mkdir apps

Change into this new directory by typing cd apps

3. Create your first Rails app

Type: rails new burgerapp in your terminal.

Note: this is the Rails command to create a new app. The third word is the name of your application - it cannot have spaces in the name.

You will see a script being run which creates a bunch of files and gets the latest gems.

Change into the new app directory: cd burgerapp

4. Starting your application

Type: rails server (or rails s is a shortcut).

Open your browser and enter localhost:3000 in the address bar.

5. Open your application code in your text editor.

For Sublime Text on Mac

  • Choose File > Open
  • Find your project folder, select it and click the Open button

For Sublime Text on Windows

  • Choose File > Open Folder
  • Find your project folder, select it and click on Open.

6. Open a new terminal window/tab.

So you can leave your Rails server running while doing new commands.

Back in your terminal, open a new tab (Mac: Cmd+t, Windows: Start > cmd).

Check that your in your application folder

Mac: pwd will show your path (Present Working Directory)

If not in correct directory, you will need to use the cd command to get to it. eg. cd apps/burgerapp.

7. Creating a controller

Type: rails generate controller home index

This Rails commmand generates some files and inserts some code in your app.

  • app/controllers/home_controller.rb
  • app/views/home/index.html.erb
  • config/routes.rb

8. Check your browser

In your browser, go to: localhost:3000/home/index

Edit the page you see by going to Sublime and finding app/views/home/index.html.erb

When you save the HTML, refresh your browser and see the changes you have made.

9. Change the routes

In Sublime, go to config/routes.rb

Find the line that looks like this: # root 'welcome#index'

Remove the # and change the code:

root 'home#index'

In your browser, return to localhost:3000

10. Add a burger database to your application

In your terminal, type: rails g scaffold Burger name description:text price:decimal

Be careful and make sure the command is exactly correct before hitting enter.

This code creates a bunch of files that will help you enter burgers into the app.

11. Create the database table with a Rails command

In your terminal, type: rake db:migrate

This is a rake command that follows the instructions in /db/migrate/....rb

12. See the new pages of your application.

In your browser, go to localhost:3000/burgers

Add some burgers to your application and see how it works.

You can find and edit the code in Sublime at app/views/burgers

Resources

  1. Free online resources & tutorials
  2. Coder Factory workshops & courses
  3. Coder Factory Academy
  4. Coder Factory workshops for businesses and schools

Free resources

Ruby on Rails Guides. Check the Getting Started tutorial.

Michael Hartl's Ruby on Rails tutorial.

Learn Ruby the Hard Way

Bootstrap

Mackenzie Child on Youtube - videos

Coder Factory workshops

Beginner weekend workshops

  • Coding for beginners
  • Wordpress for beginners
  • Web design for beginners
  • High school Coder - on school holidays

Web App Builder

Learn Fast

In just 12 weeks (six class hours per week), you will become a confident web application developer, able to build anything you want.

Full stack development

Ruby on Rails gives you full stack skills - front end, backend, databases, application design and deployment.

Build your own idea

You will have the opportunity to apply your new skills by building your own app idea in the final 4 weeks of the course.

Classes are fun and practical!

With a focus on hands-on coding in every class, you will have fun while you learn. We love our amazing students at Coder Factory, they are always smart and inspiring people to know.

Tried learning online?

If you've tried learning online but keep hitting road blocks (or boredom), the Web App Developer PT course is the best way to learn coding. Meet other aspiring startup entrepreneurs who have taken action and realised that learning to code is going to change their future.

Coder Factory Academy

  • Become a full stack developer in 24 weeks.
  • Australia's only accredited coding bootcamp.
  • 6 months full time intensive.
  • Grads receive a Diploma of Software Development and Australian citizens may be eligible for VET FEE-HELP.Includes a one month work placement in a real development team.

March intake is full but next intake starts in August.

Technology education for schools and business

Schools
  • Teacher training
  • Student workshops and courses

Please tell us your thoughts on your experience

Quick survey