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