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

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

  3. Framework

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

  5. None
  6. None
  7. None
  8. opinionated

  9. What does Rails Give you?

  10. 1. Security CSRF, SQL Injection, XSS

  11. 2. Form BUilders Succinct & Consistent Forms

  12. <form action="/posts" method="post"> <label for="post_title">Title</label> <input type="text" id="post_title"> <label for="post_body">Body</label>

    <input type="text" id="post_body"> <input type="submit" value="Save"> </form>
  13. <%= form_for(@post) do |f| %> <%= f.label :title %> <%=

    f.text_field :title %> <%= f.label :body %> <%= f.text_area :body %> <%= f.submit %> <% end %>
  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
  15. 3. REstful Router Consistent URLs

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

    PUT /posts/1 DELETE /posts/1
  17. resources :posts

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

  19. 5. Powerful ORM Active Record

  20. has_many :comments

  21. validates_presence_of :title