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
4.7k
Hanamiを支える技術 2023 / Asakusa.rb Hanami 2023
a_matsuda
2
530
Rails 7.1をn倍速くした話
a_matsuda
11
12k
RubyKaigi 2022 After Talk
a_matsuda
0
400
Coming Soon…💎 / coming soon
a_matsuda
12
7.7k
Rails Performance Issues and Solutions
a_matsuda
9
35k
Extending Rails for Real World App Development
a_matsuda
9
7.4k
A RubyKaigi Talk
a_matsuda
8
2.3k
Ginza Rails 1
a_matsuda
6
1.2k
Other Decks in Programming
See All in Programming
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.5k
距離関数を極める! / SESSIONS 2024
gam0022
0
200
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
macOS でできる リアルタイム動画像処理
biacco42
9
2.3k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
670
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
300
Tuning GraphQL on Rails
pyama86
2
1.2k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
460
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9k
Happy Clients
brianwarren
98
6.7k
Statistics for Hackers
jakevdp
796
220k
Side Projects
sachag
452
42k
Rails Girls Zürich Keynote
gr2m
94
13k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
How STYLIGHT went responsive
nonsquared
95
5.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
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