Module: ReadOnly::FormHelper

Defined in:
lib/read_only.rb

Instance Method Summary collapse

Instance Method Details

#read_only(object_name, method, options = {}) ⇒ Object



6
7
8
9
10
11
# File 'lib/read_only.rb', line 6

def read_only object_name, method, options={}
  options[:value] = Rails.application.message_verifier(method).generate(options[:value]) if options.key?(:value)
  label = label(object_name, "_#{method}")
  input = text_field(object_name, "_#{method}", options)
  (:div, label + tag(:br) + input, style: 'margin: 5px 0; display: none')
end