```ruby
require "active_record"
require "pg_search/configuration"
require "pg_search/features"
require "pg_search/normalizer"
require "pg_search/scope"
require "pg_search/scope_options"
require "pg_search/version"
#require "pg_search/railtie" if defined?(Rails) && defined?(Rails::Railtie)

module PgSearch
  extend ActiveSupport::Concern

  module ClassMethods
    def pg_search_scope(name, options)
      scope = PgSearch::Scope.new(name, self, options)
      scope_method =
        if respond_to?(:scope) && !protected_methods.include?('scope')
          :scope # ActiveRecord 3.x
        else
          :named_scope # ActiveRecord 2.x
        end

      send(scope_method, name, scope.to_proc)
    end
  end

  module InstanceMethods
    def rank
      attributes['pg_search_rank'].to_f
    end
  end
end
```

Remove conditional logic around Active Record 2 named_scope.
user
```ruby
require "active_record"
require "pg_search/configuration"
require "pg_search/features"
require "pg_search/normalizer"
require "pg_search/scope"
require "pg_search/scope_options"
require "pg_search/version"
#require "pg_search/railtie" if defined?(Rails) && defined?(Rails::Railtie)

module PgSearch
  extend ActiveSupport::Concern

  module ClassMethods
    def pg_search_scope(name, options)
      self.scope(
        name,
        PgSearch::Scope.new(name, self, options).to_proc
      )
    end
  end

  module InstanceMethods
    def rank
      attributes['pg_search_rank'].to_f
    end
  end
end
```
assistant