module TinyDyno::Attributes::Readonly

This module defines behaviour for readonly attributes.

Public Instance Methods

attribute_writable?(name) click to toggle source

Are we able to write the attribute with the provided name?

@example Can we write the attribute?

model.attribute_writable?(:title)

@param [ String, Symbol ] name The name of the field.

@return [ true, false ] If the document is new, or if the field is not

readonly.

@since 3.0.0

# File lib/tiny_dyno/attributes/readonly.rb, line 25
def attribute_writable?(name)
  new_record? || !readonly_attributes.include?(database_field_name(name))
end