lib/dynamoid/document.rb in dynamoid-0.5.0 vs lib/dynamoid/document.rb in dynamoid-0.6.0
- old
+ new
@@ -6,12 +6,13 @@
module Document
extend ActiveSupport::Concern
include Dynamoid::Components
included do
- class_attribute :options
+ class_attribute :options, :read_only_attributes
self.options = {}
+ self.read_only_attributes = []
Dynamoid::Config.included_models << self
end
module ClassMethods
@@ -25,9 +26,13 @@
# @option options [Integer] :write_capacity set the write capacity for the table; does not work on existing tables
#
# @since 0.4.0
def table(options = {})
self.options = options
+ end
+
+ def attr_readonly(*read_only_attributes)
+ self.read_only_attributes.concat read_only_attributes.map(&:to_s)
end
# Returns the read_capacity for this table.
#
# @since 0.4.0