app/models/landable/page.rb in landable-1.11.0 vs app/models/landable/page.rb in landable-1.11.1
- old
+ new
@@ -20,10 +20,12 @@
validates_with PathValidator, fields: [:path]
validates_uniqueness_of :path
validates :path, presence: true
+ validate :page_name_byte_size
+
validate :forbid_changing_path, on: :update
validate :body_strip_search
validates :redirect_url, url: true, allow_blank: true
validate :hero_asset_existence
@@ -221,9 +223,15 @@
RenderService.call(self)
rescue ::Liquid::Error => error
errors[:body] = 'contains a Liquid syntax error'
rescue StandardError => error
errors[:body] = 'had a problem: ' + error.message
+ end
+ end
+
+ def page_name_byte_size
+ if page_name.present? && page_name.bytesize > 100
+ errors[:page_name] = 'Invalid PageName, bytesize is too big!'
end
end
def hero_asset_existence
return true if @hero_asset_name.blank?