diff options
author | Job van der Voort <jobvandervoort@gmail.com> | 2015-04-21 17:21:51 +0300 |
---|---|---|
committer | Job van der Voort <jobvandervoort@gmail.com> | 2015-04-21 17:21:51 +0300 |
commit | a8e93b7f51d968c1380ed210499869b62b07fd15 (patch) | |
tree | c864e80dfd9cf4f83fcede678acc986e3a125bf5 /lib/static_model.rb | |
parent | 0625b15a481b3a3edd88110b3c18031ad9068d2f (diff) |
Version 7.10.0.rc5v7.10.0.rc5
Diffstat (limited to 'lib/static_model.rb')
-rw-r--r-- | lib/static_model.rb | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/lib/static_model.rb b/lib/static_model.rb deleted file mode 100644 index 185921d8fbe..00000000000 --- a/lib/static_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# Provides an ActiveRecord-like interface to a model whose data is not persisted to a database. -module StaticModel - extend ActiveSupport::Concern - - module ClassMethods - # Used by ActiveRecord's polymorphic association to set object_id - def primary_key - 'id' - end - - # Used by ActiveRecord's polymorphic association to set object_type - def base_class - self - end - end - - # Used by AR for fetching attributes - # - # Pass it along if we respond to it. - def [](key) - send(key) if respond_to?(key) - end - - def to_param - id - end - - def new_record? - false - end - - def persisted? - false - end - - def destroyed? - false - end - - def ==(other) - if other.is_a? ::StaticModel - id == other.id - else - super - end - end -end |