Rails 4 Topics
Chapter 1
- Ruby 1.9.3 and Whiny Nils.
- ThreadSafety enabled in production.
- Changes to
match
in routes. - Support for
patch
HTTP verb. - Route
concerns
var Component = { | |
mounted() { | |
this.setTimeOutClose() | |
}, | |
beforeDestroy() { | |
clearTimeout(this.timeout); | |
}, | |
data() { | |
return { | |
timeout: null |
<template> | |
<div> | |
<h1>Events Listing</h1> | |
<EventCard v-for="event in events" :key="event.id" :event="event"/> | |
</div> | |
</template> | |
<script> | |
import EventCard from '@/components/EventCard.vue' | |
import EventService from '@/services/EventService.js' |
{"number":90210} |
<div id="app"> | |
<h2>X are in stock.</h2> | |
</div> | |
<script> | |
var product = 'Boots' | |
</script> |
{ | |
"products": [ | |
{ | |
"id": 1, | |
"name": "Compass", | |
"price": 2.35 | |
}, | |
{ | |
"id": 2, | |
"name": "Jacket", |
Angular 2 challenge app |
match
in routes.patch
HTTP verb.concerns
# before | |
def first_or_last_name | |
if user.first_name | |
user.first_name | |
else | |
user.last_name | |
end | |
end | |
# after |
traceroute to roadrunner.com (24.28.199.168), 64 hops max, 52 byte packets | |
1 10.49.144.1 (10.49.144.1) 8.724 ms 7.492 ms 20.726 ms | |
2 ten0-3-0.orld01-ser2.bhn.net (72.31.194.58) 7.393 ms 7.171 ms 5.984 ms | |
3 ten0-4-0-3.orld71-car2.bhn.net (71.44.61.98) 22.810 ms | |
ten0-1-0-5.orld71-car2.bhn.net (71.44.60.32) 10.923 ms | |
ten0-4-0-3.orld71-car2.bhn.net (71.44.61.98) 25.203 ms | |
4 ae1-0-orld71-cbr2.bhn.net (72.31.194.2) 23.625 ms 20.251 ms 8.188 ms | |
5 ae-3-10.cr1.atl20.tbone.rr.com (66.109.6.104) 16.863 ms | |
ae-4-11.cr1.atl20.tbone.rr.com (66.109.10.14) 14.893 ms | |
ae-3-10.cr1.atl20.tbone.rr.com (66.109.6.104) 15.780 ms |
SendTwo( | |
-> | |
alert 'thing 1' | |
-> | |
alert 'thing 2' | |
) |