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
macOS なしで iOS アプリを開発する(※ただし xxx に限る)
mitsuharu
1
180
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
230
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.4k
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
170
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.4k
バグを見つけた?それAppleに直してもらおう!
uetyo
0
140
MCP with Cloudflare Workers
yusukebe
2
200
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
440
From Translations to Multi Dimension Entities
alexanderschranz
2
120
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
890
HTTP compression in PHP and Symfony apps
dunglas
2
1.6k
Haze - Real time background blurring
chrisbanes
1
500
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
270
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
800
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Become a Pro
speakerdeck
PRO
26
5k
Building an army of robots
kneath
302
44k
Automating Front-end Workflow
addyosmani
1366
200k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Facilitating Awesome Meetings
lara
50
6.1k
Designing Experiences People Love
moore
138
23k
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