Preventing URL errors

This commit is contained in:
chiu 2026-03-17 09:02:13 +00:00
parent c77ee96865
commit 43d1bf2f5e
1 changed files with 6 additions and 0 deletions

View File

@ -6,7 +6,13 @@ class RTemplate
include OrbitCategory::Categorizable
include Slug
before_validation :sanitize_git_url
def sanitize_git_url
return if self.git_url.blank?
self.git_url = self.git_url.strip.gsub(/(\.git|\/)+\z/, '')
end
field :title, as: :slug_title, :localize => true
field :description, :localize => true
field :price, :type => Integer