Module: MuckEngine::General

Extended by:
ActiveSupport::Concern
Defined in:
lib/muck-engine/models/general.rb

Instance Method Summary collapse

Instance Method Details

#dom_id(prefix = '') ⇒ Object



6
7
8
9
10
11
# File 'lib/muck-engine/models/general.rb', line 6

def dom_id(prefix='')
  display_id = new_record? ? "new" : id.to_s 
  prefix.to_s <<( '_') unless prefix.blank?
  prefix.to_s << "#{self.class.name.underscore}"
  prefix != :bare ? "#{prefix.to_s.underscore}_#{display_id}" : display_id
end

#errors_to_sObject



13
14
15
16
17
# File 'lib/muck-engine/models/general.rb', line 13

def errors_to_s
  errors.map do |e, m|
    "#{e.humanize unless e == "base"} #{m}\n"
  end.to_s.chomp
end