From 43d1bf2f5ef85eadc85c01943b2c4136be34d76a Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 17 Mar 2026 09:02:13 +0000 Subject: [PATCH] Preventing URL errors --- app/models/r_template.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/r_template.rb b/app/models/r_template.rb index deb22bf..538f589 100644 --- a/app/models/r_template.rb +++ b/app/models/r_template.rb @@ -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