There's an echo in my head

日々のメモ。

actionview

手動でRailsのビューをレンダリングする

バッチで生成しておきたいとかそういうときに。 class FooController < AbstractController::Base include AbstractController::Rendering include AbstractController::Translation include AbstractController::AssetPaths include ActionView::Layouts se…

素のオブジェクトをfields_forに使う

例えばモデル的にGraph has_many Entityだけど、GraphはActiveRecordを使う一方でEntityには素のオブジェクトを使いたい場合。データストアが異なるとか。 class Graph < ActiveRecord::Base after_save :save_entities def entities @entities ||= [] # TOD…

このブログに出てくるコードスニペッツは、引用あるいは断りがない限りMITライセンスです。