lib/yao/resources/base.rb in yao-0.3.6 vs lib/yao/resources/base.rb in yao-0.3.7

- old
+ new

@@ -4,10 +4,13 @@ module Yao::Resources class Base def self.friendly_attributes(*names) names.map(&:to_s).each do |name| define_method(name) do + if !@data.key?(name) && id + @data = self.class.get(id) + end self[name] end end end @@ -51,16 +54,16 @@ def id self["id"] end def created - if date = self["created"] + if date = self["created"] || self["created_at"] Time.parse(date) end end def updated - if date = self["updated"] + if date = self["updated"] || self["updated_at"] Time.parse(date) end end extend RestfullyAccessible