Skip to content

Instantly share code, notes, and snippets.

View lexmag's full-sized avatar

Aleksei Magusev lexmag

  • Canada
View GitHub Profile
@lexmag
lexmag / virtual_attributes.rb
Created July 5, 2012 19:30
Virtual attributes #2
module VirtualAttributes
extend ActiveSupport::Concern
class VirtualAttribute < Struct.new(:klass); end
module ClassMethods
def attr_virtual(*attrs)
options = attrs.extract_options!
attrs.each do |attr|