ruby on rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/ruby on rails - kiskolabs.pdf ·...
TRANSCRIPT
![Page 1: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/1.jpg)
Ruby on RailsLauri Jutila & Matias Korhonen
http://kiskolabs.com
![Page 2: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/2.jpg)
First a little about Ruby
![Page 3: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/3.jpg)
“Ruby is designed to make programmers happy”
Yukihiro Matsumoto
![Page 4: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/4.jpg)
puts "Hello World"
![Page 5: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/5.jpg)
Designed for people,not machines
![Page 6: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/6.jpg)
Takes the best features of many programming languages (Smalltalk, Perl, Lisp…)
![Page 7: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/7.jpg)
• Dynamic, strong typing
• Object-oriented
• Automatic memory management
![Page 8: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/8.jpg)
Everything is an object
"Hello World".class #=> String123.class #=> Fixnum9999999999999999999.class #=> Bignum9_999_999_999_999_999_999.class #=> Bignum(0.99999).class #=> Float
"hello".upcase #=> "HELLO"[1,2,3].length #=> 3
![Page 9: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/9.jpg)
Ruby on Rails
![Page 10: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/10.jpg)
Ruby on Rails is an open-source web framework that’s optimised for
developer happiness and sustainable productivity
http://rubyonrails.org/
![Page 11: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/11.jpg)
Ruby on Rails is an open-source web framework that’s optimised for
developer happiness and sustainable productivity
http://rubyonrails.org/
![Page 12: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/12.jpg)
The elevator pitch
•Convention over configuration
•DRY — Don’t Repeat Yourself
•MVC architecture
![Page 13: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/13.jpg)
And also
•Good tools
•A good community
•Good culture
This also goes for Ruby
![Page 14: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/14.jpg)
Rails Structure
![Page 15: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/15.jpg)
$
![Page 16: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/16.jpg)
$ rails new awesome_blog$
![Page 17: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/17.jpg)
$ rails new awesome_blog create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/images/rails.png create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/mailers create app/models create app/views/layouts/application.html.erb create app/mailers/.gitkeep create app/models/.gitkeep create config create config/routes.rb create config/application.rb create config/environment.rb create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb create config/initializers create config/initializers/backtrace_silencers.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/secret_token.rb create config/initializers/session_store.rb create config/initializers/wrap_parameters.rb create config/locales create config/locales/en.yml create config/boot.rb create config/database.yml create db create db/seeds.rb create doc create doc/README_FOR_APP create lib create lib/tasks create lib/tasks/.gitkeep create lib/assets create lib/assets/.gitkeep create log create log/.gitkeep create public create public/404.html create public/422.html create public/500.html create public/favicon.ico create public/index.html create public/robots.txt create script create script/rails create test/fixtures create test/fixtures/.gitkeep create test/functional create test/functional/.gitkeep create test/integration create test/integration/.gitkeep create test/unit create test/unit/.gitkeep create test/performance/browsing_test.rb create test/test_helper.rb create tmp/cache create tmp/cache/assets create vendor/assets/javascripts create vendor/assets/javascripts/.gitkeep create vendor/assets/stylesheets create vendor/assets/stylesheets/.gitkeep create vendor/plugins create vendor/plugins/.gitkeep run bundle installFetching gem metadata from https://rubygems.org/.........Using rake (0.9.2.2) Using i18n (0.6.0) Using multi_json (1.3.0) Using activesupport (3.2.3) Using builder (3.0.0) Using activemodel (3.2.3) Using erubis (2.7.0) Using journey (1.0.3) Using rack (1.4.1) Using rack-cache (1.2) Using rack-test (0.6.1) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.1.2) Using actionpack (3.2.3) Using mime-types (1.18) Using polyglot (0.3.3) Using treetop (1.4.10) Using mail (2.4.4) Using actionmailer (3.2.3) Using arel (3.0.2) Using tzinfo (0.3.33) Using activerecord (3.2.3) Using activeresource (3.2.3) Using bundler (1.1.rc.7) Using coffee-script-source (1.3.1) Using execjs (1.3.0) Using coffee-script (2.2.0) Using rack-ssl (1.3.2) Using json (1.6.6) Using rdoc (3.12) Using thor (0.14.6) Using railties (3.2.3) Using coffee-rails (3.2.2) Using jquery-rails (2.0.2) Using rails (3.2.3) Using sass (3.1.15) Using sass-rails (3.2.5) Using sqlite3 (1.3.5) Using uglifier (1.2.4) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
![Page 18: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/18.jpg)
Why so many files?
![Page 19: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/19.jpg)
Gemfile
Gemfile.lock
README.rdoc
Rakefile
app/
config/
config.ru
db/
doc/
lib/
log/
public/
script/
test/
tmp/
vendor/
External dependencies
All your codeRails app configuration
Migrations and schema
The only folder seen to the world as-is.
![Page 20: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/20.jpg)
app/
assets/
controllers/
helpers/
mailers/
models/
views/
The app directory
JavaScripts, Stylesheets, and images
Pretty self-explanatory…
![Page 21: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/21.jpg)
Every Rails app will always look like this.Unless the developer has really screwed up.
![Page 22: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/22.jpg)
=> Demo
Code: https://github.com/ljuti/aalto-on-rails
![Page 23: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/23.jpg)
Where to go?How to learn?
![Page 24: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/24.jpg)
Best Resources
• Rails Guides: http://guides.rubyonrails.org
• RailsCasts: http://railscasts.com
• Ruby Toolbox: https://www.ruby-toolbox.com
• Why Ruby? http://j.mp/WhyRuby
• IRC: The #rubyonrails channel on irc.freenode.net
![Page 25: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/25.jpg)
The Best Books
![Page 26: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/26.jpg)
Agile Web Development with Rails(4th edition)
http://pragprog.com/book/rails4/agile-web-development-with-rails
![Page 27: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/27.jpg)
Programming Ruby 1.9(3rd edition)
http://pragprog.com/book/ruby3/programming-ruby-1-9
![Page 28: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/28.jpg)
Learn to Program(2nd edition)
http://pragprog.com/book/ltp2/learn-to-program
![Page 29: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/29.jpg)
![Page 30: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/30.jpg)
• Established in 2007
• We only do Ruby
• There are now 9 of us:
• 3 designers
• 3 developers + the 2 founders
• Everybody knows how to code.
![Page 33: Ruby on Rails - aaltowebapps.comaaltowebapps.com/docs/2012_1/Ruby on Rails - KiskoLabs.pdf · •MVC architecture. And also ... Rails app configuration Migrations and schema The](https://reader033.vdocuments.net/reader033/viewer/2022051813/6030a8ac6b2bbb0a7826a78b/html5/thumbnails/33.jpg)
Frozen Rails 2012
September 20 – 21
http://2012.frozenrails.eu