skinny controller fat model
model을 꼭 AR 매핑만으로 보지 말자
fat controller test 어렵다
form_for 추천
object를 넘기면 알맞는 form을 잘 만들어준다
with_scope 유용
[].each send <- don't do i
def before_creaet 보다
before_create :make_created.....
Time.now.to_date.to_time -> Time.now.beginning_of_day
code can be self-ducument! ActiveSupport를 활용
코드를 읽고 이해할 수 있게.
루비의 장점
association proxy 사용을 simplify 이해하기 쉽게
Document.find_all_by_user_id(@john.id) -> @john.documents
읽기도 좋고, 성능도 낫다.
필드명이 바뀌는 경우에도 동작한다 예를 들면 user_id => user_xxx
하나를 골라서 지원
@john.documents.tagged_with(@cool)
Don't simply cargo-cult!
!! @a.nil?
@a ? true : false <- prefer
Billable.build_with_associations
Simplying non restful routes
with_option을 활용하자. 어느 객체에나 사용할 수 있다.
새로로 Align을 맞추면 읽기 휘워진다.
코드는 railsway에 아티클로 올라올 것!
AS에 .to_bool .to_boolean하는 것은 어떨까? !! 이디엄을 더 쉽게
override to_param
irc 채널에서 Q&A를 하는 것이 흥미로웠다. 컨퍼런스에도 인터넷은 필수!
chat은 다른 채널에서 해주세요 ㅎ
returning...
clear
prefer
multiple through 직접 만들어라 -> nested_through
private은 document thing
루비 스타일!