Sha256: ae882d09bc5a44e4177fce13ac638f88451fe1cb2416ffdad008ecfa6f174c35
Contents?: true
Size: 547 Bytes
Versions: 18
Compression:
Stored size: 547 Bytes
Contents
module SimpleForm module Components # Needs to be enabled in order to do automatic lookups. module Readonly def readonly if readonly_attribute? && !has_readonly? input_html_options[:readonly] ||= true input_html_classes << :readonly end nil end private def readonly_attribute? object.class.respond_to?(:readonly_attributes) && object.persisted? && object.class.readonly_attributes.include?(attribute_name.to_s) end end end end
Version data entries
18 entries across 18 versions & 3 rubygems