Ruby hellug
-
Upload
eleni-hourouzidou -
Category
Technology
-
view
245 -
download
0
description
Transcript of Ruby hellug
![Page 2: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/2.jpg)
Brief History
Ruby Ruby on Rails
2
![Page 3: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/3.jpg)
Framework Organizes code Provides tools Automates tasks
3
![Page 4: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/4.jpg)
Brief timeline
1993: Beginning of Ruby 1995: Ruby's first release 1999: Ruby's english documentation 2004: Creation of Ruby on Rails Today: Ruby version 2.1, RoR version
4.0.2
4
![Page 5: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/5.jpg)
Clean & elegant syntax
> 2.times { print 'We love Ruby!' }
> We love Ruby!We love Ruby! => 2
5
![Page 6: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/6.jpg)
New app, file structure
> rails new blog> cd blog> rails server
Already a functional application!!
6
![Page 7: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/7.jpg)
Scaffold: Fast functionality 7
![Page 8: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/8.jpg)
MVC8
![Page 9: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/9.jpg)
db/migrate/20140101225451_add_author_to_posts.rb
Migrations9
![Page 10: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/10.jpg)
Model Validations
10
![Page 11: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/11.jpg)
![Page 12: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/12.jpg)
Controller 12
![Page 13: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/13.jpg)
![Page 14: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/14.jpg)
Routes & RESTful routing
14
config/routes.rb
![Page 15: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/15.jpg)
Routes & RESTful routing
15
![Page 16: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/16.jpg)
What to see next
16
Codeschool Free Course: Rails for Zombies www.railsforzombies.org
Tutorial: Creating a simple ToDo application www.arubystory.blogspot.gr
Book: Rails 4 in Action (Publication 28 Mar 2014)
![Page 17: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/17.jpg)
Any Questions?
Thank you!
17
![Page 18: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/18.jpg)
18
![Page 19: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/19.jpg)
Install Ruby 2Install gem ‘rails’ in console:
> gem install railsCreate new rails app in console:
> rails new blogChange Directory (get in the app folder)
> cd blog
19
![Page 20: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/20.jpg)
Start the server > rails s
Visit rails welcome page in the browser:
localhost:3000Create Scaffold Post, in the console:
> rails g scaffold post title:string body:text
20
![Page 21: Ruby hellug](https://reader034.fdocuments.net/reader034/viewer/2022052505/554f8062b4c9052a518b4cc1/html5/thumbnails/21.jpg)
Run migration = create db table: >rake db:migrate
21