Upload
umair-amjad
View
111
Download
3
Embed Size (px)
DESCRIPTION
Overview of RoR Setting up Environment Ruby Language MVC – ActiveRecord, ActionController, ActionView REST Architecture Routing DB Migrations ActiveRecord Associations Validation/Validation Helpers Forms/ActionView helpers Assets/Bundler Caching Debugging RoR Quick-start Demo
Citation preview
Boutique product development companyIt is amazing what you can accomplish when you have a client-centric team to deliver outstanding products.
Boutique product development companyIt is amazing what you can accomplish when you have a client-centric team to deliver outstanding products.
Ruby on Rails - 101Umair Amjad | Senior Software EngineerUmer Sheikh | Software Engineer
Who we are?
Umair Amjad | Umer Sheikh
Umair AmjadSenior Software Engineer
BS CS 2006(FAST-NU)MS CS 2012(FAST-NU)
http://about.me/umairamjad
Umer SheikhSoftware Engineer
BS CS 2006(FAST-NU)MS CS 2011(FAST-NU)
http://about.me/iumersheikh
What will happen next?
Umair Amjad | Umer Sheikh
Tentative Duration: 2-4 hrsNumber of Slides: 109
Ruby on Rails 102 (Moderate)Ruby on Rails 103 (Expert)
Fun with Gems, Authenticating Users, Heroku, Capistrano, Security/Performance, Tuning, Pagination, Email in Rails, Eager Loading,
Background Tasks, Unit Testing, Internationalization & Localization ...
Ruby on Rails Workshop
Agenda:• Ruby Language
• Setting up Environment
• Overview of RoR
• MVC – ActiveRecord, ActionController, ActionView
• Routing
• Assets/Bundler
• REST Architecture
• DB Migrations
• Console
• ActiveRecord Associations
• Logging
• Validation/Validation Helpers
• Forms/ActionView helpers
• Caching
• Debugging
Umair Amjad | Umer Sheikh
Nice-to-Have
Umair Amjad | Umer Sheikh
- Basics of Linux- Basic knowledge of Html, CSS, JS- Frameworks- Client Server Architecture- HTTP methods- MVC (Model View Controller)- ORM (Object-relational mapping)
Ruby on Rails - Users
Umair Amjad | Umer Sheikh
- Amazon (internal)- Intel (internal)- HP (internal)- NASA (internal)- Twitter (in early age)- Basecamp- Slideshare- Pakwheels- Github- YellowPages
Umair Amjad | Umer Sheikh
Primary:http://www.tutorialspoint.com/ruby/index.htmThe Little Book Of Ruby
References:http://www.codecademy.com/tracks/rubyhttp://www.rubyist.net/~slagell/ruby/getstarted.htmlhttp://rubymonk.com/learning/books/1-ruby-primer
Try Ruby online:http://www.compileonline.com/execute_ruby_online.php
Umair Amjad | Umer Sheikh
http://setuprubyonrails.blogspot.com/2012/04/ruby-on-rails-environment-setup-on.html
rvm install [ruby_version]rvm install 1.9.2
rvm use [ruby_version]rvm use 1.9.2
rvm gemset create [gemset_name]rvm gemset create rails3.1.3
rvm use [ruby_version]@[gemset_name]rvm use [email protected]
Umair Amjad | Umer Sheikh
Rake is Ruby make, a make-like language written in Ruby.
Rails uses Rake extensively, especially for the innumerable little administrative tasks necessary when developing database-backed web applications.
Rake tasks are loaded from the file Rakefile
Rails rake tasks live under /lib/tasks
You can put your own tasks under lib/tasks
bundle exec rake -Tbundle exec rake -T db #See a list of database tasks
Umair Amjad | Umer Sheikh
db: DatabaseThe most common tasks of the db: Rake namespace are migrate and create, and it will pay off to try out all of the migration rake tasks (up, down, redo, reset). rake db:version is useful when troubleshooting, telling you the current version of the database.
rails: Rails-specific tasksAfter upgrading Rails, it is useful to run rails:update, which will update your config and scripts directories, and upgrade your Rails-specific javascript
rake stats #gives summary statistics about your code
rake routes #lists all your defined routes
rake secret
Umair Amjad | Umer Sheikh
gem install debugger
class PeopleController < ApplicationController
def new
debugger
@person = Person.new
end
end
$ rails server --debugger
=> Booting WEBrick
=> Rails 4.0.0 application starting on http://0.0.0.0:3000
=> Debugger enabled
Umair Amjad | Umer Sheikh
rails console
The console command lets you interact with your Rails application from the command line. On the underside, rails console uses IRB, so if you've ever used it, you'll be right at home. This is useful for testing out quick ideas with code and changing data server-side without touching the website.
rails dbconsole
rails dbconsole figures out which database you're using and drops you into whichever command line interface you would use with it (and figures out the command line parameters to give to it, too!). It supports MySQL, PostgreSQL, SQLite and SQLite3.