Class: Disclaimer::Document

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/disclaimer/document.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



26
27
28
29
30
31
32
33
# File 'app/models/disclaimer/document.rb', line 26

def method_missing(method, *args)  
  segment = args.first     
  if act_as_list_methods.include?(method.to_sym) and segment.kind_of? Segment
    modify_via_segment_holder_acts_as_list_method(method, segment)
  else
    super(method, *args)
  end     
end

Instance Method Details

#segment_holder_for(segment) ⇒ Object



13
14
15
# File 'app/models/disclaimer/document.rb', line 13

def segment_holder_for(segment)
  segment_holders.where(:segment_id => segment.id).first
end

#titleObject



21
22
23
# File 'app/models/disclaimer/document.rb', line 21

def title
  ((!super || super.empty?) && name.present?) ? name.humanize : super
end

#to_paramObject



17
18
19
# File 'app/models/disclaimer/document.rb', line 17

def to_param
  name
end