spec/dummy/app/models/user.rb in doorkeeper-mongodb-5.0.0 vs spec/dummy/app/models/user.rb in doorkeeper-mongodb-5.2.0
- old
+ new
@@ -1,27 +1,15 @@
-case DOORKEEPER_ORM.to_s
-when /mongoid/
- class User
- include Mongoid::Document
- include Mongoid::Timestamps
+# frozen_string_literal: true
- field :name, type: String
- field :password, type: String
- end
-when "mongo_mapper"
- class User
- include MongoMapper::Document
- timestamps!
+# [NOTE] MongoMapper support was dropped, so now only Mongoid
+class User
+ include Mongoid::Document
+ include Mongoid::Timestamps
- key :name, String
- key :password, String
- end
-end
+ field :name, type: String
+ field :password, type: String
-class User
- if ::Rails.version.to_i < 4 || defined?(::ProtectedAttributes)
- attr_accessible :name, :password
- end
+ attr_accessible :name, :password if defined?(::ProtectedAttributes)
def self.authenticate!(name, password)
User.where(name: name, password: password).first
end
end