Fix hound warnings

This commit is contained in:
decabeza
2019-01-29 17:54:02 +01:00
parent 41fe1e3922
commit 2695e19e2f
6 changed files with 24 additions and 20 deletions

View File

@@ -54,7 +54,8 @@ module AdminHelper
end
def menu_customization?
["pages", "banners", "information_texts"].include?(controller_name) || menu_homepage? || menu_pages?
["pages", "banners", "information_texts"].include?(controller_name) ||
menu_homepage? || menu_pages?
end
def menu_homepage?

View File

@@ -1,6 +1,6 @@
class SiteCustomization::Page < ActiveRecord::Base
VALID_STATUSES = %w(draft published)
has_many :cards, class_name: 'Widget::Card', foreign_key: 'site_customization_page_id'
VALID_STATUSES = %w[draft published]
has_many :cards, class_name: "Widget::Card", foreign_key: "site_customization_page_id"
translates :title, touch: true
translates :subtitle, touch: true
@@ -13,9 +13,11 @@ class SiteCustomization::Page < ActiveRecord::Base
format: { with: /\A[0-9a-zA-Z\-_]*\Z/, message: :slug_format }
validates :status, presence: true, inclusion: { in: VALID_STATUSES }
scope :published, -> { where(status: 'published').order('id DESC') }
scope :with_more_info_flag, -> { where(status: 'published', more_info_flag: true).order('id ASC') }
scope :with_same_locale, -> { joins(:translations).where("site_customization_page_translations.locale": I18n.locale) }
scope :published, -> { where(status: "published").order("id DESC") }
scope :with_more_info_flag, -> { where(status: "published",
more_info_flag: true).order("id ASC") }
scope :with_same_locale, -> { joins(:translations)
.where("site_customization_page_translations.locale": I18n.locale) }
def url
"/#{slug}"

View File

@@ -1,6 +1,6 @@
class Widget::Card < ActiveRecord::Base
include Imageable
belongs_to :page, class_name: 'SiteCustomization::Page', foreign_key: 'site_customization_page_id'
belongs_to :page, class_name: "SiteCustomization::Page", foreign_key: "site_customization_page_id"
# table_name must be set before calls to 'translates'
self.table_name = "widget_cards"