From e3ca85d5b2de748948555f0386fbdbff45641462 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 25 Jun 2020 16:37:34 -0300 Subject: [PATCH] =?UTF-8?q?no=20cambiar=20el=20dise=C3=B1o=20si=20es=20per?= =?UTF-8?q?sonalizado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/design.rb | 6 ++++++ app/models/site.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/design.rb b/app/models/design.rb index aeacb79..b925147 100644 --- a/app/models/design.rb +++ b/app/models/design.rb @@ -8,6 +8,8 @@ class Design < ApplicationRecord extend Mobility + NO_THEMES = %w[sutty-theme-none sutty-theme-custom].freeze + translates :name, type: :string, locale_accessors: true translates :description, type: :text, locale_accessors: true @@ -16,4 +18,8 @@ class Design < ApplicationRecord validates :name, presence: true, uniqueness: true validates :gem, presence: true, uniqueness: true validates :description, presence: true + + def no_theme? + NO_THEMES.include? gem + end end diff --git a/app/models/site.rb b/app/models/site.rb index 3cb268b..ceeea4f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -414,7 +414,7 @@ class Site < ApplicationRecord # TODO: Guardar la configuración también, quizás aprovechando algún # método de ActiveRecord para que lance un salvado recursivo. def sync_attributes_with_config! - config.theme = design.gem unless design.gem == 'sutty-theme-custom' + config.theme = design.gem unless design.no_theme? config.description = description config.title = title config.url = url