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