0

每当我尝试计算从 datamapper 返回的记录时,它总是返回为 0,无论是否有用户。

User.count(:username=>params[:username])

class User
  include DataMapper::Resource

  property :id,  Serial
  property :username,  String, unique_index: true, required: true, length: 3..32
  property :password,  String, required: true, length: 5..64
  property :email,  String, unique_index: true, required: true, format: :email_address

end
4

1 回答 1

0

您可以User.all(:username=>params[:username])在控制台中尝试然后尝试

User.count(:username=>params[:username])对于那个 ENV

于 2012-12-13T12:51:53.400 回答