Sha256: a4ffed9d2e318ef76e20bde21ebb3440f0b5f959d9f53e317db17bbcd86c5990
Contents?: true
Size: 761 Bytes
Versions: 12
Compression:
Stored size: 761 Bytes
Contents
# -*- encoding : utf-8 -*- def virtual? true end def history? false end def followable? false end def db_content Card::Virtual.fetch_content(self) end # called to refresh the virtual content # the default way is to use the card's template content def generate_virtual_content template&.db_content end event :save_virtual_content, :prepare_to_store, on: :save, changed: :content do Card::Virtual.fetch(self) { attributes["db_content"] } abort :success end event :delete_virtual_content, :prepare_to_store, on: :delete do Card::Virtual.find_by_card(self)&.delete abort :success end def delete # delete although it's new update_attributes trash: true end def delete! # delete although it's new update_attributes! trash: true end
Version data entries
12 entries across 12 versions & 1 rubygems