to_jsonの履歴
railsの配列を簡単にjsonにしてくれる便利ツール
{ word:<%= @word.to_json(:only => [:id, :title]) %> parents:<%= @word.parents.map{|w|w.from}.to_json(:only => [:id, :title]) %> children:<%= @word.children.map{|w|w.to}.to_json(:only => [:id, :title]) %> }
railsの配列を簡単にjsonにしてくれる便利ツール
{ word:<%= @word.to_json(:only => [:id, :title]) %> parents:<%= @word.parents.map{|w|w.from}.to_json(:only => [:id, :title]) %> children:<%= @word.children.map{|w|w.to}.to_json(:only => [:id, :title]) %> }