-
Notifications
You must be signed in to change notification settings - Fork 7
Agenda for Beginner Workshop
- Fix any remaining installation problems
- Check and verify Ruby and Rails versions
Sample app: App for participant registration for a workshop like this.
resource: participant with typical properties:
name, email, profession, attended_meetups (boolean), remarks(text)
New app
› rails new workshop.sample
› bin/rails s
» [Browse] localhost:3000
The scaffold resource: participant
› bin/rails g scaffold participant name:string email:string profession:string \
attended_meetups:boolean remarks:text
› bin/rake db:migrate
» [Browse] localhost:3000/participants
Index page
› bin/rails g controller welcome index
›
› Edit config/routes: uncomment: root 'welcome#index'
› Edit app/views/welcome/index.html.erb: Add: Hello world
» [Browse] localhost:3000
Here we try to get the sample app deployed to heroku
Heroku account setup
› create heroku account
› install heroku toolbelt
› heroku create chennairb-rails-workshop
› git remote add heroku git@heroku.com:chennairb-rails-workshop.git
Heroku Deploy
› Edit Gemfile: replace 'sqlite3' with 'pg'
› git init .; git add .; git commit -m 'first commit'
› git push heroku master
› heroku run rake db:migrate
›
› [Lecture][short] What happened in the deployment
Concepts
› [Lecture][short] HTTP, HTML
› [Lecture][detailed] Route: (slides 67-70)
› [Lecture][detailed] MVC
› [Walkthough][] the files created by the scaffold
Another sample scaffold
› bin/rails generate coach name email twitter_handle
› bin/rake db:migrate
» [Browse] localhost:3000/coaches
ruby basics
› ruby hello-world-program.rb
› irb› puts 'Hello world'
› [Lecture][detailed] Hello world (slides: 5-25)
› Exercises (from slides)
› [Lecture][detailed] Arrays/Loops/Hashes/Methods (slides: 26-46)
› Exercises (from slides)
ruby OOP
› [Lecture][short] Class and method
› [Lecture][short] Class methods
› [Lecture][short] Ruby Object model
› [Lecture][short] Inheritence and composition
› [Lecture][short] Polymorphism
ruby gems
› [Lecture][short] intro to the gem ecosystem
› Ruby standard library
› ruby-toolbox.com
Console
› Use the Rails console to see the value of active-record objects
› Rails console
› heroku run console
› Participant.last
Model operations
› Validations: add for email
› Database migrations: add a field to participant living_in_chennai:boolean
› Associations: Add has_maby between coaches and participants
Adding a gem
To demonstrate how common it is to use gems instead of coding.
› Add and configure the devise gem
Redeploy
› [Lecture][short] Minitest/Rspec
› [Walkthrough][] Auto generated test templates
› A sample test
Very small details about some commonly heard terms.
To just get people started
› Version managers: rvm, rbenv
› Internationalization
› Front-end: Jquery, Ember
› Design: Bootstrap
› Testing: TDD
› Sys-admin: Nginx, Apache, Ubuntu, Capistrano, unicorn
› Cloud: Heroku, AWS, Digital Ocean
› Server automation: Chef, Puppet, Ansible, Docker
› Local ruby community
› Global communities
› MINSWAN
› Participation of women
Slides: http://www.slideshare.net/vysakh0/ruby-on-rails-for-beginners