Module: Cliches::ActiveRecordExtension

Defined in:
lib/cliches/active_record_extension.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#cliche(name = nil) ⇒ Object



3
4
5
6
# File 'lib/cliches/active_record_extension.rb', line 3

def cliche(name = nil)
  full_name = [name, table_name.singularize].compact.join("_")
  new(Cliches::Definition.find(full_name).value)
end

#cliche!(name = nil) ⇒ Object



8
9
10
11
12
# File 'lib/cliches/active_record_extension.rb', line 8

def cliche!(name = nil)
  record = cliche(name)
  record.save!
  record
end