2012-01-01から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…

coffeescriptも勉強中だしjqueryも勉強中だし

ってことでjqueryの本に載ってることをcoffeescriptで書き直してます。で、実際に動かしてみるときはRailsで環境を作ってます。coffeescriptからjavascriptへの変換はRailsに任せましょう。 generateまで rails new cs cd cs rails generate controller Cafe…

coffeescript

coffeescriptのシンタックス・ハイライトは無さそうなのでjavascriptでやってみる。 $ -> $("#click_here_button") .click -> $("li#2").prependTo $("li#1") .click -> $("li#3").prepend $("li#1").html() + " " 今jqueryの勉強してるのですが、jqueryの本…