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

Designing and building software with Ruby on Rails

Designing and building software with Ruby on Rails

In this talk I explained how Ruby on Rails has changed the web and how it influenced other frameworks, also I detailed about the meaning of "On Rails" way and showed that Rails is a solution driven framework.

B5dce3bdf38e652f73ee65ffe25d7931?s=128

Rodrigo Boniatti

September 27, 2018
Tweet

Transcript

  1. Designing and building software with Ruby on Rails

  2. Rodrigo Boniatti Developer at Codeminer 42 @boniattirodrigo rodrigoboniatti.com

  3. None
  4. Talk’s goals • How Rails has changed the web •

    On Rails way • Solution driven
  5. How Rails has changed the web

  6. Startup environment

  7. Agile movement Dave Thomas Martin Fowler

  8. None
  9. Continuos integration

  10. On Rails way • Convention over configuration • Don’t repeat

    yourself (DRY) • Implicit instead of explicit • Opinionated
  11. Convention over configuration

  12. > rails g scaffold User name:string age:integer enabled:boolean

  13. invoke active_record create db/migrate/create_users.rb create app/models/user.rb invoke test_unit create test/models/user_test.rb

    create test/fixtures/users.yml invoke resource_route route resources :users invoke scaffold_controller create app/controllers/users_controller.rb invoke erb create app/views/users create app/views/users/index.html.erb create app/views/users/edit.html.erb create app/views/users/show.html.erb create app/views/users/new.html.erb create app/views/users/_form.html.erb invoke test_unit create test/controllers/users_controller_test.rb create test/system/users_test.rb
  14. invoke active_record create db/migrate/create_users.rb create app/models/user.rb invoke test_unit create test/models/user_test.rb

    create test/fixtures/users.yml
  15. invoke resource_route route resources :users

  16. invoke scaffold_controller create app/controllers/users_controller.rb invoke erb create app/views/users create app/views/users/index.html.erb

    create app/views/users/edit.html.erb create app/views/users/show.html.erb create app/views/users/new.html.erb create app/views/users/_form.html.erb invoke test_unit create test/controllers/users_controller_test.rb create test/system/users_test.rb
  17. class User < ActiveRecord::Base end

  18. User.create!(name: 'Rodrigo', age: 22, enabled: true) User.first.name => "Rodrigo"

  19. Rails.application.routes.draw do resources :users end

  20. class Post < ActiveRecord::Base has_many :comments belongs_to :author enum status:

    %i[draft review published] end
  21. post = Post.first post.draft? post.author_id

  22. Convention over configuration • Table name is plural • Primary

    key is called id • Column names are instance attributes
  23. Assets pipeline • Merge all files • Minification and compression

    • Transpiling
  24. None
  25. Tooling

  26. None
  27. RuboCop rules • Class length • Methods length • Parameters

    list • Unused variable • Indentation
  28. None
  29. None
  30. None
  31. None
  32. None
  33. None
  34. None
  35. None
  36. None
  37. None
  38. Inspirations

  39. Conclusion • Don't reinvent the wheel • Funny language •

    Plug and play
  40. Thanks ;)