2012-03-29から1日間の記事一覧

なんかメモだけ残ってたので思い出して書く

active_support関連で。 require 'active_support/all' def a return [1] end def b return nil end c = b || a d = b.presence || a この場合cもdも、aの結果である[1]になる。次、 def a return [1] end def b return [] end c = b || a c = b.presence ||…

Mongoid

ここ見ながら、使い方に迷っていたので。 class Person include Mongoid::Document embeds_one :name attr_accessible :name end class Name include Mongoid::Document field :vorname, type: String field :nachname, type: String embedded_in :person en…