has_permalink
has_permalink copied to clipboard
Number Fix Issue (with Fix)
On this line https://github.com/olkarls/has_permalink/blob/master/lib/has_permalink.rb#L56 the permalink searches for itself so if you update a model, it always appends a number which isn't correct. Instead the 'where' clause should tell it to not count it's own ID
n = self.class.where(["permalink = ? AND id != ?", permalink, id]).count