May 10, 2015
1Intro to Ruby on Rails
Ruby Hellug – 4th of Jan 2014Eleni Chourouzidou ([email protected])
Brief History
Ruby Ruby on Rails
2
Framework Organizes code Provides tools Automates tasks
3
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
Clean & elegant syntax
> 2.times { print 'We love Ruby!' }
> We love Ruby!We love Ruby! => 2
5
New app, file structure
> rails new blog> cd blog> rails server
Already a functional application!!
6
Scaffold: Fast functionality 7
MVC8
db/migrate/20140101225451_add_author_to_posts.rb
Migrations9
Model Validations
10
Controller 12
Routes & RESTful routing
14
config/routes.rb
Routes & RESTful routing
15
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)
Any Questions?
Thank you!
17
18
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
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
Run migration = create db table: >rake db:migrate
21