Module: ActiveFedora::AttributeMethods::Write
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_fedora/attribute_methods/write.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- WriterMethodCache =
Class.new(AttributeMethodCache) do private def method_body(method_name, const_name) <<-EOMETHOD def #{method_name}(value) name = ::ActiveFedora::AttributeMethods::AttrNames::ATTR_#{const_name} write_attribute(name, value) end EOMETHOD end end.new
Instance Method Summary collapse
Instance Method Details
#write_attribute(attribute_name, value) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/active_fedora/attribute_methods/write.rb', line 23 def write_attribute(attribute_name, value) if self.class.properties.key?(attribute_name) @attributes[attribute_name] = value else raise ActiveModel::MissingAttributeError, "can't write unknown attribute `#{attribute_name}'" end end |