hyper-mesh
hyper-mesh copied to clipboard
implement alias_attribute
Also support Model#load for aliased attributes like:
module ActiveRecord
module InstanceMethods
def load(*attributes, &block)
first_time = true
ReactiveRecord.load do
results = attributes.collect { |attr| send("#{model._dealias_attribute(attr)}#{'!' if first_time}") }
results = yield(*results) if block
first_time = false
block.nil? && results.count == 1 ? results.first : results
end
end
end
end