Permalink
Browse files

Merge pull request #316 from norman/optimisations

Removed or begin in favour of ||= do
  • Loading branch information...
2 parents d5888e6 + d4a8089 commit fae2d2fab8d1379e10350a3c43e98cfe927220c0 @norman committed Aug 1, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/friendly_id/base.rb
View
@@ -199,11 +199,9 @@ def friendly_id(base = nil, options = {}, &block)
# on first access. If you're concerned about thread safety, then be sure
# to invoke {#friendly_id} in your class for each model.
def friendly_id_config
- @friendly_id_config or begin
- @friendly_id_config = base_class.friendly_id_config.dup.tap do |config|
- config.model_class = self
- @relation_class = base_class.send(:relation_class)
- end
+ @friendly_id_config ||= base_class.friendly_id_config.dup.tap do |config|
+ config.model_class = self
+ @relation_class = base_class.send(:relation_class)
end
end

0 comments on commit fae2d2f

Please sign in to comment.