Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby 2 and Rails 4
Search
Akira Matsuda
November 21, 2012
Programming
43
7k
Ruby 2 and Rails 4
「Ruby 2.0 & Rails 4.0先取りセミナー」の講演資料
(2012/11/21, Web CAT Studioさん主催)
http://atnd.org/events/33996
Akira Matsuda
November 21, 2012
Tweet
Share
More Decks by Akira Matsuda
See All by Akira Matsuda
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
13
5.4k
Hanamiを支える技術 2023 / Asakusa.rb Hanami 2023
a_matsuda
2
560
Rails 7.1をn倍速くした話
a_matsuda
11
12k
RubyKaigi 2022 After Talk
a_matsuda
0
420
Coming Soon…💎 / coming soon
a_matsuda
12
7.9k
Rails Performance Issues and Solutions
a_matsuda
9
36k
Extending Rails for Real World App Development
a_matsuda
9
7.5k
A RubyKaigi Talk
a_matsuda
8
2.4k
Ginza Rails 1
a_matsuda
6
1.2k
Other Decks in Programming
See All in Programming
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
380
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
610
為你自己學 Python
eddie
0
510
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
220
良いユニットテストを書こう
mototakatsu
11
3.5k
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
290
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
3
200
Compose UIテストを使った統合テスト
hiroaki404
0
130
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
190
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.3k
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.3k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
The Language of Interfaces
destraynor
155
24k
The Cult of Friendly URLs
andyhume
78
6.1k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Typedesign – Prime Four
hannesfritz
40
2.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
Designing for Performance
lara
604
68k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
172
50k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Scaling GitHub
holman
459
140k
Transcript
Ruby 2.0 & Rails 4.0 দా ໌ (@a_matsuda)
whoami GitHub: amatsuda Twitter: @a_matsuda
None
https://forkwell.com/ ϑϦʔϥϯεͷࣾ֎औక (Ṗ) pull requestʹίϝϯτॻ͘ͻͱ
before
ůŢ RubyKaigiʹࢀՃͨ͜͠ͱ͋Δਓʁ Railsษڧձ@౦ژʹࢀՃͨ͜͠ͱ͋Δਓʁ Asakusa.rbʹࢀՃͨ͜͠ͱ͋Δਓʁ
begin
ຊͷ͓ 2ͭͷʮϝδϟʔόʔδϣϯΞοϓʯ
ϝδϟʔόʔδϣϯΞοϓʂ Ruby: 1.9.3 => 2.0.0 Rails: 3.2.9 => 4.0.0
ۭલͷ ϝδϟʔόʔδϣϯΞοϓظʂ Ruby 2.0 Rails 4.0 Rake 10.0 RubyGems 2.0
RDoc 4.0 RSpec 3.0 Sprockets 3.0 Capybara 2.0 Rubinius 2.0 ...
ϝδϟʔόʔδϣϯΞοϓظ ࣌ͷస ৺ػҰస ࢀೖͷνϟϯεʂ
Ruby 2.0
Ruby 2.0 (Matzͷ)ͷ൵ئ 2001ͷୈ1ճRubyConfͷΩʔϊʔτͰ Matz͕طʹRuby 2.0ʹݴٴ ʮֆʹඳ͍ͨṷʯʮ೩ྉʯʮχϯδϯʯ ʮPerl 6ʯ
Rubyͷྺ࢙ 199302݄ ੜ (1993/2/24) 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄
1.1 199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8 201302݄ 2.0
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8
͜ͷࠒͷόʔδϣχϯάϧʔϧ ۮ൪߸͕҆ఆ൛
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8 200712݄ 1.9.0 (։ൃ൛) Matz's Ruby Ko1's Ruby
͜ͷࠒͷόʔδϣχϯάϧʔϧ 2έλͷࣈ͍ͨ͘ͳ͍ => 1.10.0 ͋Γಘͳ͍ 2.0ͬͯࣈ·͍ͩͨ͘ͳ͍ 1.9.0։ൃ൛ɺ1.9.1͕҆ఆ൛ͰͲ͏͔
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8 200712݄ 1.9.0 (։ൃ൛) 201008݄ 1.9.2 (΄Μͱ͏ͷ҆ఆ൛)
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8 200712݄ 1.9.0 (։ൃ൛) 201008݄ 1.9.2 (҆ఆ൛) 201110݄ 1.9.3 (҆ఆ൛)
Rubyͷόʔδϣϯ൪߸ͷมભ 1 1.2 1.4 1.6 1.8 2 1995/12 1996/12 1997/08
1998/12 1999/08 2000/09 2003/08 2007/12 2010/08 2011/10
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8 200712݄ 1.9.0 (։ൃ൛) 201008݄ 1.9.2 (҆ఆ൛) 201110݄ 1.9.3 (҆ఆ൛) 201302݄ 2.0
2003ͷ·ͭͱ͞ΜͷεϥΠυ http://www.rubyist.net/~matz/slides/rc2003/mgp00009.html
2003ͷ·ͭͱ͞ΜͷεϥΠυ http://www.rubyist.net/~matz/slides/rc2003/mgp00009.html ࠓճͷ2.0Ͱ࣮
Rubyͷྺ࢙ 199302݄ ੜ 199512݄ ެ։ (0.95) 199612݄ 1.0 199708݄ 1.1
199812݄ 1.2 199908݄ 1.4 200009݄ 1.6 200308݄ 1.8 200712݄ 1.9.0 (։ൃ൛) 201008݄ 1.9.2 (҆ఆ൛) 201302݄ 2.0
2.0ͷϦϦʔε 20132݄24 ʮੜʯ͔Βͪΐ͏Ͳ20प લͱ͔ʹ 2.0ϦϦʔεه೦ & ੜ20पΠϕϯτ Έ͍ͨͳͷ͕͋ΔΜ͡Όͳ͍͔ͳ͊
1.9.3..2.0.0 1.8..1.9΄Ͳͷbig jumpͰͳ͍ ຊʹॏ͍ͨมߋ(= Ѩඓڣש) 1.9Ͱࡁ·ͤͨ YARVɹ Encodingɹ 1.92.0 preͩͬͨɺͱݴ͑Δ͔
2.0ͷಛ ࠷ॳ͔Β҆ఆ൛Λࢤ 2.0.0͕ग़ͨॠ͔ؒΒ ҆৺͓͍͍͚ͯͨͩ͠·͢ 1.9.3ͱͷޓੑΛॏࢹ 1.9.3͔ΒεϜʔζʹҠߦͰ͖·͢ ඇޓͳมߋ2.1Ҏ߱ʹ
1.9.3..2.0.0 ৽ػೳ ύϑΥʔϚϯεͷ্ VM GC require σϑΥϧτεΫϦϓτΤϯίʔσΟϯά ͍ͭʹσϑΥϧτUTF-8ʹʂ ͔ͨ͠͠Β࠷େͷඇޓ (ʁ)
ύϑΥʔϚϯεͷ্ VM GC require
VM: @ko1
None
GC: @nari3
None
ύϑΥʔϚϯεͷ্ (DEMO) Railsͷىಈ࣌ؒ RubyͷόʔδϣϯΛ্͛Δ͚ͩͰഒʹʂ
σϑΥϧτεΫϦϓτΤϯίʔσΟϯά ͍ͭʹσϑΥϧτUTF-8ʹʂ (ϚδίϝͱԿͩͬͨͷ͔…) ͔ͨ͠͠Β࠷େͷඇޓ (ʁ)
ϚδίϝͱԿͩͬͨͷ͔ ΒϢʔβʔʹͱͬͯඞཁͳஈ֊ͩͬͨ String͕encodingΛ࣋ͭͱ͍͏֓೦ CSIɹ internal encoding, external encodingɹ US-ASCII, ASCII-8BIT,
BINARYɹ mojibake == ࢮ
ਆల։ encodingɺͳΜͱͳ͘Θ͔ͬͨͰ͠ΐʁ => σϑΥϧτUTF-8 ͞Μ͍͢͝
@nalsh
None
M17Nʹ͍ͭͯৄ͘͠ ʰA Reintroduction To Ruby M17Nʱ http://www.slideshare.net/nalsh/a-reintroduction- to-ruby-m17-n ʰ Ruby
M17N ͷઃܭͱ࣮ʱ http://jp.rubyist.net/magazine/?0025- Ruby19_m17n
Ruby 2.0ͷ৽ػೳ Refinements Module#prepend Enumerable#lazy ΩʔϫʔυҾ ͳͲͳͲ
Ruby 2.0ͷ৽ػೳ ͋ͱͰ
Rails 4.0
Railsͷόʔδϣϯ൪߸ͷભҠ 200407݄ ެ։ 200512݄ 1.0 200712݄ 2.0 201008݄ 3.0 2012-2013
4.0
ϝδϟʔόʔδϣϯΞοϓʹ͏ ৽ύϥμΠϜ 1.0 DRY, CoC 2.0 RESTful 3.0 Modularity
ϝδϟʔόʔδϣϯΞοϓʹ͏ ৽ύϥμΠϜ 1.0 DRY, CoC 2.0 RESTful 3.0 Modularity 4.0
ಛʹͳ͠ʂ
Rails 4 ʮ৽ػೳʯ͍Ζ͍Ζ ʮ৽ύϥμΠϜʯಛʹͳ͍ جຊతʹ3.2ͷਖ਼ৗਐԽܥ 4.0ʹ͖͔͚ͨͬ͠ɺRuby 1.8αϙʔτͷ ऴྃ(ʁ)
Railsͷόʔδϣϯ൪߸ઓུ όʔδϣϯ൪߸ͳΜͯ০Γ Railsઈ͑ؒͳ͘มԽ͢Δ1ຊͷઢ࿏Ͱɺ όʔδϣϯͷ۠Γ్தӺͷΑ͏ͳͷ
Railsͷʮ৽ʯόʔδϣϯ൪߸ઓུ ৽͍͠όʔδϣϯͰ͑ͳ͘ͳΔػೳ ͍͖ͳΓফ͞ͳ͍ 1ݸલͷόʔδϣϯͰ deprecation warningΛ ग़͢ ࣍ͷόʔδϣϯͰফ͢
4.0ͷಛ ࠷ॳ͔Β҆ఆ൛Λࢤ 4.0.0͕ग़ͨॠ͔ؒΒ ҆৺͓͍͍͚ͯͨͩ͠·͢ 3.2.xͱͷޓੑΛॏࢹ 3.2.x͔ΒεϜʔζʹҠߦͰ͖·͢
Railsͷόʔδϣϯ൪߸ઓུ όʔδϣϯ൪߸ͳΜͯ০Γ Railsઈ͑ؒͳ͘มԽ͢Δ1ຊͷઢ࿏Ͱɺ όʔδϣϯͷ۠Γ్தӺͷΑ͏ͳͷ ͳͷͰɺ4.0ͷ৽ػೳ͕Ͳ͏͜͏ݴ͏ΑΓ ·ͣɺେ͖ͳྲྀΕΛѲ͢Δͱྑ͍͔
࠷ۙͷைྲྀ Modern Speed Security Real-time web ActiveRecord Social coding
Modern Ruby '>= 1.9.3'ɹ APIͷ͞ΒͳΔચ࿅ ݹ͍ػೳɺ͋Μ·ΓΘΕͯͳ͍ػೳΛ ΓΓ֎෦Gem
৽API AR͍Ζ͍Ζ AR.where! AR.all (= .scoped) scope :foo, -> {}
NullRelation AR::Model, AMo::Model update_columns AR.where.not PATCH verb routing concern Russian doll caching
RIP Ruby 1.8 support vendor/plugins ActiveResource AR.find :all dynamic finders
ActiveRecord::SessionStore Rack::Cache
Speed ύϑΥʔϚϯε্ Ruby 1.9Ҡߦʹ͏ίʔυͷεϦϜԽ Sprocketsͷprecompile threadsafe! AS::Queue TurboLinks
Security ʮMass Assignment Securityʯ =>ʮStrong Parametersʯ
Real-time web AC::Live (@tenderlove)
@tenderlove
AC::Live "Real Time Salami" https://speakerdeck.com/ tenderlove/real-time-salami
ActiveRecord @tenderlove @jonleighton PostgreSQL
@jonleighton
Social coding 2721 peopleʂ http://contributors.rubyonrails.org/ɹ ೆถ @josevalim @spastorino ൴Βʹଓ͘ୈ3ੈ
@josevalim
@spastorino
͓͠Βͤ @josevailm is speaking at RubyKaigi 2013ʂ
Ruby 2.0ͷʁ
RubyConfͰ͠Όͬͨͭ Ruby 2.0 on Rails http://speakerdeck.com/u/a_matsuda/p/ruby-2- dot-0-on-rails Ruby 2.0 on
Rails (video) http://www.confreaks.com/videos/1275- rubyconf2012-ruby-2-0-on-rails
ensure The new Ruby world is coming!ɹ People are making
the Ruby world better everyday! Meet the people (= the community) and say "Hi!" to them! <3 <3 <3
ensure Welcome to the new Ruby world!ɹ Meet the people
at: Asakusa.rbɹ Railsษڧձ େߐށRubyձٞ03 RubyKaigi 2013
end