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

Read the release note of Rails 5.2

Read the release note of Rails 5.2

Kento Nagata

March 28, 2018
Tweet

More Decks by Kento Nagata

Other Decks in Programming

Transcript

  1. 2017.7.19 | ©2017 Wantedly, Inc. Read the release note of

    Rails 5.2 Rails 5.2ͷϦϦʔεϊʔτΛಡΜͰݟΔ 2018/03/28 @ngtk
  2. 2017.7.19 | ©2017 Wantedly, Inc. 4 - Major Features -

    Active Storage - Redis Cache Store - HTTP/2 Early Hints - Credentials - Content Security Policy
 
 - Changes on each modules - Action Pack - Action View - Action Mailer - Active Record - Active Model - Active Support - Active Job Release note contents
  3. 2017.7.19 | ©2017 Wantedly, Inc. 5 - Paperclip΍CarrierwaveͳͲͷ୅ସ͑ - Amazon

    S3, Google Cloud Storage, Microsoft Azure Blob StorageΛόοΫΤϯυͱͯ͠ରԠ - μΠϨΫτΞοϓϩʔυ΋ରԠ - ײ૝: ࠓ͔Βஔ͖׵͑ΔఔͷϝϦοτ͸ͳͦ͞͏ͱ͍͏ ҹ৅ Active Storage
  4. 2017.7.19 | ©2017 Wantedly, Inc. 6 - ࠓ·Ͱ͸Ωϟογϡػߏͱͯ͠ɺϝϞϦ΍ϩʔΧϧετ ϨʔδɺMemcachedΛඪ४Ͱఏڙ -

    redis-railsͱ͍͏gem͕͕͋ͬͨɺඪ४ͰରԠͨ͠ - hiredis(cͷ࣮૷)ʹ΋ରԠ - ײ૝: ඞཁͳ΋ͷ͕ͪΌΜͱऔΓࠐ·Εͨײ͋ͬͯྑ͍ Redis cache store
  5. 2017.7.19 | ©2017 Wantedly, Inc. 7 - H2 Push͸ɺ༧ΊඞཁͳαϒϦιʔεΛฦ͓ͯͨ͘͠Ί ͷ࢓૊Έ

    - Reverse Proxy͕͋ͬͯOrigin͕H2Λ࿩ͤͳ͍৔߹ɺ H2 Push͸࢖͑ͳ͍ - Early Hints͸ɺOrigin(H1.1)͕Reverse Proxy(H2)ʹα ϒϦιʔεΛ఻͑ΔͨΊͷ࢓༷ HTTP/2 Early Hints
  6. 2017.7.19 | ©2017 Wantedly, Inc. 8 - RailsͰ͸ྫ͑͹`javascript_include_tag`΍ `stylesheet_link_tag`ʹؚ·ΕͨϦιʔεΛ͕Μ͕Μ 103

    Early HintsͰฦ͍ͯ͘͠ - ࠓͷͱ͜ΖpumaͷΈରԠ - ײ૝: pumaΛ࢖͍ͬͯΕ͹ҙ֎ͱγϡοͱԸܙΛड͚Ε ͦ͏ʁ HTTP/2 Early Hints
  7. 2017.7.19 | ©2017 Wantedly, Inc. 9 - credentials.yml.encͰ҉߸Խ͞ΕͨΩʔΛ؅ཧ͢Δ - 5.1Ͱಋೖ͞ΕͨEncrypted

    secrets͸ɺͳ͔ͬͨ͜ͱʹ ͳΓͦ͏ - 伴͸RAILS_MASTER_KEYͰ؅ཧ Credentials
  8. 2017.7.19 | ©2017 Wantedly, Inc. 10 - ENVͰ੾Γସ͑Δͱ͔͸ߟ͑ΒΕ͍ͯͳ͍ - ͭ·Γɺdevelopmentͱstagingͱ͔ͷ͜ͱ͸ߟྀ͞Ε

    ͍ͯͳ͍Ά͍ - ͨͩ͠ɺࣗ෼ͰͦΕΒͷػߏΛ࡞Ε͹͍͚Δ͔΋ʁ - https://github.com/rails/rails/pull/ 30067#issuecomment-372760099 Credentials
  9. 2017.7.19 | ©2017 Wantedly, Inc. 11 - ײ૝ - ͳΜͰ͜͏ͳͬͨײ͕͍͢͝

    - ͋·Γඪ४ͷ࢓૊ΈʹཔΒͳ͍΄͏͕ྑͦ͞͏ - ͜ͷล͸ଞͷϓϩδΣΫτͰͲ͏΍͍ͬͯΔͷ͔͕ؾ ʹͳΔ Credentials
  10. 2017.7.19 | ©2017 Wantedly, Inc. 12 - XSS΍ύέοτ౪ௌͳͲͷ߈ܸΛ๷͙ͨΊͷηΩϡϦ ςΟϨΠϠʔ -

    ίϯςϯπ͕औಘՄೳͳυϝΠϯΛઃఆ͢Δ͜ͱͰҙਤ ͠ͳ͍ίϯςϯπͷऔಘ΍࣮ߦΛ๷͙ - secureheadersͱ͍͏Gem͕͕͋ͬͨɺඪ४ͰରԠ Content Security Policy (CSP)
  11. 2017.7.19 | ©2017 Wantedly, Inc. 14 - ײ૝ - ͪΌΜͱ׆༻͍ͨ͠

    - ಋೖ͸ɺϩΪϯάΛͯ͠໰୊ΛݟΔ͚ΔϑΣʔζ͕͋ Δ͸ͣͳͷͰɺͦͷ΁Μͷϊ΢ϋ΢΍ӡ༻ʹ͍ͭͯڞ ༗͍ͨ͠ Content Security Policy (CSP)
  12. 2017.7.19 | ©2017 Wantedly, Inc. 16 - Bootsnap͸ҎԼͷํ๏Ͱૣ͍ͯ͘͠Δ - require΍loadͷ݁ՌΛΩϟογϡ

    - RubyVM::InstructionSequeΛ࢖ͬͯrubyͷίʔυΛόΠφϦ σʔλԽͯ͠Ωϟογϡ - YAMLϑΝΠϧΛMessagePack(·ͨ͸Marshal)ͷܗࣜͰΩϟο γϡ Railties / Bootsnap
  13. 2017.7.19 | ©2017 Wantedly, Inc. 18 - database.ymlͰYamlͷܧঝΛ࢖Θͣʹ஋Λڞ༗ Ͱ͖ΔsharedηΫγϣϯΛ௥Ճ #28896

    - .ruby-version΍GemfileͰͷόʔδϣϯࢦఆͳ Ͳ͕σϑΥϧτͰߦΘΕΔΑ͏ʹͳͬͨɻ #30016 Railties / Others
  14. 2017.7.19 | ©2017 Wantedly, Inc. 19 - database.ymlͰYamlͷܧঝΛ࢖Θͣʹ஋Λڞ༗ Ͱ͖ΔsharedηΫγϣϯΛ௥Ճ #28896

    - .ruby-version΍GemfileͰͷόʔδϣϯࢦఆͳ Ͳ͕σϑΥϧτͰߦΘΕΔΑ͏ʹͳͬͨɻ #30016 Railties / Others
  15. 2017.7.19 | ©2017 Wantedly, Inc. 23 - ActiveJobͷ೚ҙΫϥε͕ࢦఆͰ͖ΔΑ͏ʹͳͬͨ #29457 -

    ActionMailer͸͢΂ͯActionMailer::DeliveryJobΛར༻͍ͯ͠Δ - ΤϥʔϋϯυϦϯάͳͲ೚ҙͷରԠ͍ͨ͠έʔεͰ׆༻Ͱ͖ͦ͏ Action Mailer
  16. 2017.7.19 | ©2017 Wantedly, Inc. 24 - [MySQL] descending indexΛαϙʔτ

    - Fixtureͷ౤ೖ࣌ʹͰBluk insert͢ΔΑ͏ʹͳͬͨ - ΫΤϦ͕ൃߦ͞ΕͨίʔυΛϩάͰग़ྗͰ͖ΔΑ͏ʹͳͬͨ Active Record 3VCZHFN-PBE NT 4&-&$5SVCZHFNT '30.SVCZHFNT8)& ↳BQQWJFXTOFXT@WFSTJPOIUNMFSCJO
  17. 2017.7.19 | ©2017 Wantedly, Inc. 25 * ྫ֎`StatementTimeout`ͱ`LockWaitTimeout`ͱ`QueryCanceled` ͷ௥Ճ *

    `StatementTimeout`: λΠϜΞ΢τɺMySQLͱPostgresʹରԠ * `LockWaitTimeout`: ϩοΫͷλΠϜΞ΢τ * `QueryCanceled`: MySQLͷΈରԠɻPostgres͸ `StatementTimeout`ʹ·ͱΊΒΕΔ Active Record
  18. 2017.7.19 | ©2017 Wantedly, Inc. 30 • Redis cache store΍Early

    hintsͳͲ͸͙͢ʹ׆༻Ͱ͖ͦ͏ • CSP͸ಋೖ͕࣌େมͦ͏͕ͩɺʮඪ४ͰରԠͰ͖Δରࡦʯ͕૿͑ͨ ͷ͸ͱͯ΋ྑ͍ • Ωϟογϡͷόʔδϣχϯά΋׆༻Ͱ͖ͦ͏ • BootsnapͰͷߴ଎Խ΍ActiveRecordͰͷ৽ػೳ͸೔ৗͰ׆༻Ͱ͖ ͦ͏ͳ΋ͷ͕ଟ͍ ·ͱΊ