Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Riding Rails

Riding Rails

Brief introduction to Ruby and Rails for a workshop that took place during CodeWeek @ DI in University of Minho

Fernando Mendes

October 16, 2014
Tweet

More Decks by Fernando Mendes

Other Decks in Programming

Transcript

  1. gem install rails If you have Ruby installed: To install

    Ruby on OS X: 1. Install Homebrew 2. brew install rbenv ruby-build To install Ruby on Linux: \curl -sSL https://get.rvm.io | bash -s stable --ruby --rails
  2. What I will be talking about 1. Ruby syntax 2.

    Basic Rails What I won’t be talking about: 1. Design 2. Patterns 3. Good practices Basic concepts = slides Everything else = examples
  3. Ruby is NOT Java Object oriented Testable Programmer happiness Everything

    is an object “So beautiful, tears are shed” _why, the lucky stiff
  4. Duck typing “If it walks like a duck, swims like

    a duck and quacks like a duck, it’s probably a duck.”
  5. Classes Operator override just feels more natural. If you don’t

    like it, we also have Object#eql? and Object#equal?
  6. Classes Only this is going to get returned. If we

    wanted to write the correct method we would have to use the && operator.
  7. Classes public: default value, accessed by anyone protected: method can

    be accessed by the class or subclasses private: method can only be accessed by the class
  8. Blocks and High Order Functions x is unchanged x is

    changed Ruby convention: ! ending methods change the object ? ending methods return a boolean
  9. External libraries (gems) are imported into your project. Can have

    specified versions, minimum version, etc. Can Should be divided into groups Not necessarily Rails-exclusive Gemfile