Slide 1

Slide 1 text

Application from A to Z A.K.A. From Zero to Deploy Rails makes you develop your web application with a smile on the face, I promise.

Slide 2

Slide 2 text

Fact This is not Ruby! Her name is Rania and known as Ruby! en.wikipedia.org/wiki/Ruby_(Egyptian_singer)

Slide 3

Slide 3 text

Amr and Ruby A True Love Story Since 2007... Six years! Yes! the longest relationship I've ever had!

Slide 4

Slide 4 text

"Ruby on Rails" or just "Rails"? Ruby on Rails became Rails with version 3.0 after partially merging some components from Merb framework.

Slide 5

Slide 5 text

gem install rails Rails is a collection of Ruby Gems

Slide 6

Slide 6 text

Fire the terminal and your favourite editor. Let's Build a Quick Application

Slide 7

Slide 7 text

rails new rails generate rails db rails console rails server Rails Command

Slide 8

Slide 8 text

rails new ./demoapp -T Also, theres lots of options to pass. Type rails to see the options and the defaults. I skip installing Test Units. It will run bundle install after. Rails New

Slide 9

Slide 9 text

bundle || bundle install || bundle update Bundler is a Ruby dependency manager. Rails uses Bundler mainly to manage its dependencies and gems. Bundler, ah?

Slide 10

Slide 10 text

Rails adopts MVC architecture ● Model ○ Database and logic ● View ○ Layout, views, what end-user sees. ● Controller ○ The layer between the models and the views Read more: net.tutsplus.com/tutorials/ruby/why-rails |-- Gemfile |-- Gemfile.lock |-- app | |-- assets | |-- controllers | |-- helpers | |-- mailers | |-- models | `-- views |-- config |-- config.ru |-- db |-- doc |-- lib |-- log |-- public |-- script |-- tmp `-- vendor Rails Application Layout

Slide 11

Slide 11 text

rails generate The main Rails generators (or the handy ones): rails g scaffold rails g model rails g controller rails g migration Rails Generate

Slide 12

Slide 12 text

rails g scaffold rails generate scaffold MODEL_NAME [field[:type][:index] (...)] [options] Example rails generate scaffold post title:string body:text Rails Generate Scaffold

Slide 13

Slide 13 text

Rails Generate Scaffold

Slide 14

Slide 14 text

Let's Run the Server rails server Go to http://0.0.0.0:3000

Slide 15

Slide 15 text

Let's Run the Server http://uxyd.deviantart.com/art/Rainbow-Dash-Vector-306294452

Slide 16

Slide 16 text

Let's Run the Server Go to http://0.0.0.0:3000/posts http://uxyd.deviantart.com/art/Shocked-Rainbow-Dash-307904818

Slide 17

Slide 17 text

Let's Run the Server No posts table? No problem! run: rake db:migrate Notice, we use sqlite3 database. The database will be created automatically. For other databases run the command below before rake db:migrate. rake db:create

Slide 18

Slide 18 text

Let's Run the Server, again!

Slide 19

Slide 19 text

Let's Build a Real Application Demo Time http://uxyd.deviantart.com/art/Oh-My-Gosh-302709822

Slide 20

Slide 20 text

Let's Deploy heroku.com Using Just some simple commands: ● Add it to a Git repository ○ git init ○ git add . ○ git commit -m "a message - lets deploy" ● Install Heroku Toolbelt: toolbelt.heroku.com ● heroku create ● git push heroku master ● heroku run db:migrate (use pg in prooduction) ● heroku open

Slide 21

Slide 21 text

Thank you Amr Numan Tamimi @amrnt