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.8k
Hanamiを支える技術 2023 / Asakusa.rb Hanami 2023
a_matsuda
2
550
Rails 7.1をn倍速くした話
a_matsuda
11
12k
RubyKaigi 2022 After Talk
a_matsuda
0
410
Coming Soon…💎 / coming soon
a_matsuda
12
7.8k
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.4k
Ginza Rails 1
a_matsuda
6
1.2k
Other Decks in Programming
See All in Programming
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
650
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
Discord Bot with AI -for English learners-
xin9le
1
120
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
testcontainers のススメ
sgash708
1
120
命名をリントする
chiroruxx
1
380
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
740
return文におけるstd::moveについて
onihusube
1
750
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Why Our Code Smells
bkeepers
PRO
335
57k
How STYLIGHT went responsive
nonsquared
95
5.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
KATA
mclloyd
29
14k
A Philosophy of Restraint
colly
203
16k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Embracing the Ebb and Flow
colly
84
4.5k
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