Lets Get on Rails Venkat Subramaniam svenkat@cs.uh.edu 1 Whats - - PDF document

let s get on rails
SMART_READER_LITE
LIVE PREVIEW

Lets Get on Rails Venkat Subramaniam svenkat@cs.uh.edu 1 Whats - - PDF document

Lets Get on Rails Venkat Subramaniam svenkat@cs.uh.edu 1 Whats Rails? Web Development Frameworks Build on Ruby (so called Ruby on Rails) Agile Lightweight Heavily relies on Convention over configuration Venkat


slide-1
SLIDE 1

1

Venkat Subramaniam – svenkat@cs.uh.edu

Let’s Get on Rails

2

Venkat Subramaniam – svenkat@cs.uh.edu

What’s Rails?

  • Web Development Frameworks
  • Build on Ruby (so called Ruby on Rails)
  • Agile
  • Lightweight
  • Heavily relies on Convention over

configuration

slide-2
SLIDE 2

3

Venkat Subramaniam – svenkat@cs.uh.edu

Built On Some Key Principles

  • Rails follows some good principles

– MVC – DRY – Convention over configuration – “Unit Testing” – actually more than unit testing, though they call it that – Created bottom up – from real project, not designed by a committee

4

Venkat Subramaniam – svenkat@cs.uh.edu

Convention Over Configuration

  • No heavy XML based configuration
  • As long as you follow convention, you

need to do less work

– A bit of a problem for newbies – You love it once you get used to it

  • You name files in a certain way, put them

in specific places, …

  • You can deviate from conventions if you

like, but the configuration is also using ruby, so fairly easy

slide-3
SLIDE 3

5

Venkat Subramaniam – svenkat@cs.uh.edu

Rails and MVC

  • Rails follows MVC
  • It actually does not simply promote MVC,

it follows you home, sits with you, and makes sure you follow it

  • Controller receives request
  • You access model to manipulate data
  • It transfers control to a view for display

Browser

Controller

Model View

Business rules + data R O U T I N G

6

Venkat Subramaniam – svenkat@cs.uh.edu

MVC in Rails

  • Convention over configuration

– URL maps to an action on controller

  • Controller performs logic
  • Rails copies fields of controller to view
  • View generates response to be rendered
  • View: Action View
  • Controller: Action Controller
  • Model: Active Records
slide-4
SLIDE 4

7

Venkat Subramaniam – svenkat@cs.uh.edu

Let’s Build and Learn

  • We will build an application and learn

about Rails, conventions, etc. using that example as a vehicle