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

Ruby on Rails – A Primer

Ruby on Rails – A Primer

What is Ruby on Rails? When is it the right tool for the job? What powerful features can you use in all of your web applications?

Oliver Legg

July 29, 2013
Tweet

More Decks by Oliver Legg

Other Decks in Programming

Transcript

  1. Ruby on Rails
    a primer

    View Slide

  2. RUBY on Rails iS...
    an opinionated web application
    development framework

    View Slide

  3. Framework

    View Slide

  4. web application
    By any other name — Jeremy Keith
    http://adactio.com/journal/6246/

    View Slide

  5. View Slide

  6. View Slide

  7. View Slide

  8. opinionated

    View Slide

  9. What does Rails Give
    you?

    View Slide

  10. 1. Security
    CSRF, SQL Injection, XSS

    View Slide

  11. 2. Form BUilders
    Succinct & Consistent Forms

    View Slide


  12. Title

    Body



    View Slide

  13. <%= form_for(@post) do |f| %>
    <%= f.label :title %>
    <%= f.text_field :title %>
    <%= f.label :body %>
    <%= f.text_area :body %>
    <%= f.submit %>
    <% end %>

    View Slide

  14. <%= simple_form_for(@post) do |f| %>
    <%= f.input :title %>
    <%= f.input :body %>
    <%= f.button :submit %>
    <% end %>
    simple_form
    https://github.com/plataformatec/simple_form

    View Slide

  15. 3. REstful Router
    Consistent URLs

    View Slide

  16. GET /posts
    GET /posts/1
    GET /posts/new
    POST /posts
    GET /posts/1/edit
    PUT /posts/1
    DELETE /posts/1

    View Slide

  17. resources :posts

    View Slide

  18. 4. Asset Pipeline
    Best Practices for CSS &
    Javascript

    View Slide

  19. 5. Powerful ORM
    Active Record

    View Slide

  20. has_many :comments

    View Slide

  21. validates_presence_of :title

    View Slide