code for startup mvp (ruby on rails) session 1
TRANSCRIPT
![Page 1: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/1.jpg)
Learning to Code for Startup MVP
Presented by Henry Shi
![Page 2: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/2.jpg)
Agenda – Wednesday November 7
1. Review of Last Session
2. Ruby Basicso Syntax and semanticso Syntax and semantics
o Practice makes perfect
1. Rails Models (but no Bottles)o ORM and SQL introduction
o Migrations
o Making the User model
o Signup/Signin/Signout
![Page 3: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/3.jpg)
Prework – Setup
• Windows (not recommended if possible):o http://railsinstaller.org/
o Use Sublime Text for your text editor
• OSX:• OSX:o http://railsinstaller.org/
o This includes osx-gcc-installer (200mb)
• Linux:o http://blog.sudobits.com/2012/05/02/how-to-install-
ruby-on-rails-in-ubuntu-12-04-lts/
![Page 4: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/4.jpg)
Prework - Git
Install git if not already included:
http://www.git-scm.com/book/en/Getting-
Started-Installing-Git
Configure Git:
git config --global user.name "Your Name“
git config --global user.email
![Page 5: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/5.jpg)
Review of Last Session
1. The Web and How it Works
2. Git/Github
3. Rails and Ruby
4. Heroku
![Page 6: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/6.jpg)
The Web - Overview
![Page 7: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/7.jpg)
GIT/GITHUB
• What is GIT?
• Distributed Version Control System (DVCS)
• Why should I care?• Why should I care?o Never lose data or accidentally overwrite, delete files
o Collaborate with peers anywhere and stay in sync
automatically (no more _v1, _v2, _final, _final_final…)
o Compare and track changes over time, and easily
revert changes
o Deploy code to real web
![Page 8: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/8.jpg)
Rails
• Ruby on Rails is an open-source web
framework that’s optimized for programmerhappiness and sustainable productivity.
• It lets you write beautiful code by favoring
convention over configuration.
• 80/20 Rule =>great for Startup MVP
![Page 9: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/9.jpg)
Heroku
What is Heroku?
• a hosted platform built specifically for
deploying Rails and other web applications in
1 command1 command
• Best thing since sliced bread
![Page 10: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/10.jpg)
Ruby – Programmer’s Best Friend
• Ruby is a dynamic, open source
programming language with a focus on
simplicity and productivity. It has an
elegant syntax that is natural to read and elegant syntax that is natural to read and
easy to write.
• We will only cover the necessary syntax
needed to create a rails app
• Thankfully, its not a lot ☺
![Page 11: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/11.jpg)
Interactive Ruby Shell
• For the following slides, you should follow
along with the Interactive Ruby Shell (irb)
• Open a terminal, type irb and press enter• Open a terminal, type irb and press enter
![Page 12: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/12.jpg)
Ruby - Strings
• Characters (letters, digits, punctuation)
surrounded by quotes
food = "chunky bacon"
puts "I'm hungry for, #{food}!">> "I'm hungry for, chunky bacon!"
• Can perform operations on strings,
concatenation, length, empty, etc
>> "I'm hungry for, chunky bacon!"
“Hello” + “World”>> “Hello World"
“Henry”.empty?>> false
![Page 13: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/13.jpg)
Ruby - Numbers
• Self Explanatory
123.class>> Fixnum
(123.0).class>> Float
• Can add different types of numbers directly
![Page 14: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/14.jpg)
Ruby - Symbols
• Characters (letters, digits, punctuation)
preceded by colon (:)
food = :hello
:asf3fasdf.class>> Symbol
• Lightweight strings
• immutable
>> Symbol
![Page 15: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/15.jpg)
Ruby - Array
• List surrounded by square brace and
separated by commas, zero indexed
a = [1, 2, 3]
b = ('a'..'e').to_a # ["a", "b", "c", "d", "e"]
c = %w[foo bar baz quux] # ["foo", "bar", "baz", "quux"]
• Can perform operations on arrays, add,
remove, reverse etc
![Page 16: Code for Startup MVP (Ruby on Rails) Session 1](https://reader036.vdocument.in/reader036/viewer/2022073120/55d50711bb61eb55338b46c2/html5/thumbnails/16.jpg)
ERROR: undefined
OFFENDING COMMAND: f‘~
STACK: