Class: Ecm::Links::Category

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/ecm/links/category.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for_actual_localeObject



38
39
40
# File 'app/models/ecm/links/category.rb', line 38

def self.for_actual_locale
  where(locale: I18n.locale)
end


42
43
44
# File 'app/models/ecm/links/category.rb', line 42

def self.for_link_footer
  where(arel_table['link_footer_column'].not_eq(nil)).for_actual_locale
end

Instance Method Details

#humanObject



30
31
32
# File 'app/models/ecm/links/category.rb', line 30

def human
  name
end


66
67
68
# File 'app/models/ecm/links/category.rb', line 66

def links_count
  links.count
end

#long_description(options = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'app/models/ecm/links/category.rb', line 46

def long_description(options = {})
  options.reverse_merge!(as: :plain)
  case options[:as]
  when :html
    markup(self[:long_description])
  else
    self[:long_description]
  end
end

#short_description(options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'app/models/ecm/links/category.rb', line 56

def short_description(options = {})
  options.reverse_merge!(as: :plain)
  case options[:as]
  when :html
    markup(self[:short_description])
  else
    self[:short_description]
  end
end

#to_sObject



34
35
36
# File 'app/models/ecm/links/category.rb', line 34

def to_s
  human
end