Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Created June 24, 2013 15:53
Show Gist options
  • Save ashleygwilliams/5851101 to your computer and use it in GitHub Desktop.
Save ashleygwilliams/5851101 to your computer and use it in GitHub Desktop.
sinatra learning objectives

Sinatra

Learning Objectives

Level 0

  • scaffold a basic sinatra app
    • app.rb
    • config.ru
    • Gemfile
  • gemfiles, what are they
    • rubygems.org
    • gem 'sinatra'
    • bundle install
  • write routes
    • http_request '/path' do
  • make views
    • views folder
    • .erb files
  • connect routes and views
    • erb keyword
    • filenames as symbols
  • routes and variable scope
    • instance variables

PART 1

  • public folders
    • we have to make em
    • what goes in there? stuff that DOESN'T need to be rendered aka 'static'
  • layout, pages
    • layout.erb, with yield, has head
    • page.erb can be rendered inside

PART 2

  • having a lib
    • another folder
    • we gotta include it
  • using your lib files in your route
    • let's do it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment