Preventing URL errors
This commit is contained in:
parent
c77ee96865
commit
43d1bf2f5e
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue