app/models/georgia/concerns/slugable.rb in georgia-0.7.6 vs app/models/georgia/concerns/slugable.rb in georgia-0.7.7

- old
+ new

@@ -12,9 +12,11 @@ validates :slug, format: {with: /^[a-zA-Z0-9_-]+$/, message: 'can only consist of letters, numbers, dash (-) and underscore (_)'}#, uniqueness: {scope: [:ancestry, :type], message: 'has already been taken'} before_validation :sanitize_slug after_save :update_url + scope :from_url, -> (path) { where(url: "/#{path}").includes(current_revision: :contents) } + # Must stay public for #update_url on descendants def set_url self.update_column(:url, '/' + self.ancestry_url) end \ No newline at end of file