Module: PolepinHelper

Defined in:
app/helpers/polepin_helper.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to_associations(record_class) ⇒ Object



23
24
25
# File 'app/helpers/polepin_helper.rb', line 23

def belongs_to_associations(record_class)
  Polepin::Utility.class_belongs_to_associations(record_class)
end

#collection_name(association) ⇒ Object



11
12
13
# File 'app/helpers/polepin_helper.rb', line 11

def collection_name(association)
  association.name.to_s.humanize
end

#has_many_associations(record_class) ⇒ Object



27
28
29
# File 'app/helpers/polepin_helper.rb', line 27

def has_many_associations(record_class)
  Polepin::Utility.class_has_many_associations(record_class)
end


19
20
21
# File 'app/helpers/polepin_helper.rb', line 19

def link_to_collection(record, association)
  link_to collection_name(association), send("#{association.name}_polepin_#{record.class.table_name.singularize}_url", record.id)
end


15
16
17
# File 'app/helpers/polepin_helper.rb', line 15

def link_to_record(record)
  link_to record_name(record), send("polepin_#{record.class.table_name.singularize}_url", record.id)
end

#record_name(record) ⇒ Object



7
8
9
# File 'app/helpers/polepin_helper.rb', line 7

def record_name(record)
  Polepin::Utility.record_name(record)
end

#timestamp_columns(model_class) ⇒ Object



3
4
5
# File 'app/helpers/polepin_helper.rb', line 3

def timestamp_columns(model_class)
  Polepin::Utility.timestamp_columns(model_class)
end