Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow multiple scopes

  • Loading branch information...
commit 96835e1c6874f38ca54e7252c5345d4a37cdd181 1 parent ff45528
@technoweenie authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/permalink_fu.rb
View
8 lib/permalink_fu.rb
@@ -80,8 +80,12 @@ def create_unique_permalink
conditions << id
end
if self.class.permalink_options[:scope]
- conditions.first << " and #{self.class.permalink_options[:scope]} = ?"
- conditions << send(self.class.permalink_options[:scope])
+ scopes = [self.class.permalink_options[:scope]]
+ scopes.flatten!
+ scopes.each do |scope|
+ conditions.first << " and #{scope} = ?"
+ conditions << send(scope)
+ end
end
while self.class.exists?(conditions)
suffix = "-#{counter += 1}"
Please sign in to comment.
Something went wrong with that request. Please try again.