Class: Georgia::Widget

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Concerns::Contentable
Defined in:
app/models/georgia/widget.rb

Instance Method Summary collapse

Instance Method Details

#content_presenceObject



17
18
19
20
21
# File 'app/models/georgia/widget.rb', line 17

def content_presence
  contents.each do |content|
    errors.add(:base, I18n.t("locales.#{content.locale}") + ' Title is required.') unless content.title.present?
  end
end

#featured?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/georgia/widget.rb', line 23

def featured?
  @featured ||= pages.any?
end


27
28
29
# File 'app/models/georgia/widget.rb', line 27

def featured_count
  @featured_count ||= pages.count
end