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

It would be hard to create Rails without ActiveSupport

It would be hard to create Rails without ActiveSupport

You know you can use ActiveRecord without Rails. But, do you know that you CAN'T use Rails without ActiveSupport?

Muhammad Mufid Afif

June 29, 2018
Tweet

More Decks by Muhammad Mufid Afif

Other Decks in Programming

Transcript

  1. $ irb 2.3.5 :001 > 1+1 => 2 $ rails

    console Loading development environment (Rails 5.1.4) 2.3.5 :001 > 1+1 => 2
  2. $ irb 2.3.5 :001 > 1.days.ago $ rails console Loading

    development environment (Rails 5.1.4) 2.3.5 :001 > 3.days.ago
  3. $ irb 2.3.5 :001 > 1.days.ago NoMethodError: undefined method `days'

    for 3:Fixnum $ rails console Loading development environment (Rails 5.1.4) 2.3.5 :001 > 3.days.ago => Mon, 25 Jun 2018 09:11:12 UTC +00:00
  4. $ irb 2.3.5 :001 > 1.days.ago NoMethodError: undefined method `days'

    for 3:Fixnum 2.3.5 :002 > require 'active_support/all'
  5. $ irb 2.3.5 :001 > 1.days.ago NoMethodError: undefined method `days'

    for 3:Fixnum 2.3.5 :002 > require 'active_support/all' => true
  6. $ irb 2.3.5 :001 > 1.days.ago NoMethodError: undefined method `days'

    for 3:Fixnum 2.3.5 :002 > require 'active_support/all' => true 2.3.5 :003 > 3.days.ago => 2018-06-25 16:13:24 +0700
  7. Can you use Rails without ActiveRecord? Yes Can you use

    Rails without ActionCable? Yes Can you use Rails without ActiveStorage?
  8. Can you use Rails without ActiveRecord? Yes Can you use

    Rails without ActionCable? Yes Can you use Rails without ActiveStorage? Yes
  9. Can you use Rails without ActiveRecord? Yes Can you use

    Rails without ActionCable? Yes Can you use Rails without ActiveStorage? Yes Can you use Rails without ActiveJob?
  10. Can you use Rails without ActiveRecord? Yes Can you use

    Rails without ActionCable? Yes Can you use Rails without ActiveStorage? Yes Can you use Rails without ActiveJob? Yes
  11. Can you use Rails without ActiveRecord? Yes Can you use

    Rails without ActionCable? Yes Can you use Rails without ActiveStorage? Yes Can you use Rails without ActiveJob? Yes Can you use Rails without ActiveSupport?
  12. Can you use Rails without ActiveRecord? Yes Can you use

    Rails without ActionCable? Yes Can you use Rails without ActiveStorage? Yes Can you use Rails without ActiveJob? Yes Can you use Rails without ActiveSupport? No
  13. actioncable (5.1.4) actionpack (= 5.1.4) nio4r (~> 2.0) websocket-driver (~>

    0.6.1) actionpack (5.1.4) actionview (= 5.1.4) activesupport (= 5.1.4) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2)
  14. actionview (5.1.4) activesupport (= 5.1.4) builder (~> 3.1) erubi (~>

    1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3)
  15. > "User".constantize.find(1) User Load (25.4ms) SELECT "users".* FROM "users" WHERE

    "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] => #<User id: 1, email: "[email protected]">
  16. > "User".find(1) User Load (25.4ms) SELECT "users".* FROM "users" WHERE

    "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] => #<User id: 1, email: "[email protected]">
  17. ActiveSupport::Notifications.subscribe "deliver.action_mailer" do |*args| event = ActiveSupport::Notifications::Event.new(*args) tags = {

    mailer: event.payload[:mailer] } collector.increment "rails.mail.sent", tags: tags, inherit_tags: true end
  18. Action Controller write_fragment.action_controller read_fragment.action_controller expire_fragment.action_controller exist_fragment?.action_controller write_page.action_controller expire_page.action_controller start_processing.action_controller process_action.action_controller

    send_file.action_controller send_data.action_controller redirect_to.action_controller halted_callback.action_controller unpermitted_parameters.action_controller Action View render_template.action_view render_partial.action_view render_collection.action_view Active Record sql.active_record instantiation.active_record
  19. Action Mailer receive.action_mailer deliver.action_mailer process.action_mailer Active Support cache_read.active_support cache_generate.active_support cache_fetch_hit.active_support

    cache_write.active_support cache_delete.active_support cache_exist?.active_support Active Job enqueue_at.active_job enqueue.active_job perform_start.active_job perform.active_job Action Cable perform_action.action_cable transmit.action_cable transmit_subscription_confirmation.action_cable transmit_subscription_rejection.action_cable broadcast.action_cable
  20. THANKYOU NO Q&A but let’s talk on the SOURCE CODE

    AND SLIDE: SPEAKERDECK.COM/MUFID i am mufid let’s make software, better, together! mail me privately at [email protected] or tweet publicly to me to @mufid
  21. AgileCampus.org Training Depok, Jawa Barat August/September 2018 <IDR500k/pax Deliver your

    software, faster. BDD for the rest of us using cucumber Know the cost of fixing defect software Build software more effectively by testing it continuously Understanding fast iteration in agile.
  22. THANKYOU NO Q&A but let’s talk on the SOURCE CODE

    AND SLIDE: SPEAKERDECK.COM/MUFID i am mufid let’s make software, better, together! mail me privately at [email protected] or tweet publicly to me to @mufid