Module: Labelize::ClassMethods

Defined in:
lib/labelize.rb

Instance Method Summary collapse

Instance Method Details

#find(*args) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/labelize.rb', line 29

def find(*args)
  f = args.first
  if f.is_a? String and f.to_i == 0
    result = send("find_by_#{self._finder_label}",*args)
	raise ActiveRecord::RecordNotFound unless result
	result
  else
    super *args
  end
end

#optionsObject



23
24
25
# File 'lib/labelize.rb', line 23

def options
  all.map(&:to_option)
end

#to_sentenceObject



26
27
28
# File 'lib/labelize.rb', line 26

def to_sentence
  all.to_sentence
end