-2
编辑:清理这个问题了通过删除不必要的细节语法错误,我不明白
我试图使用数据映射红宝石,但我不断收到这个语法错误,我不知道如何解决它:
user.rb:1: syntax error, unexpected keyword_class, expecting $end
include DataMapper...
^
user.rb:
require 'data_mapper'
class User
include DataMapper::Resource
property :id, Serial #serial means auto-incrementing PK
property :uname, String, :key=>true
property :name, String
property :email, String
property :is_locked, Boolean, :default=>false
property :image, String
property :must_change_psw, String, :default=>false
property :salt, String, :accessor=>:private
property :hash, String, :accessor=>:private
#returns true if the password provided is correct AND the user is not locked
def correct? (pass)
return (self.hash==hash(pass,self.salt))&!self.is_locked
end
end
def hash(secret,salt)
return true #for now
end
我会下载并安装以前的版本试试 –
试图与红宝石1.9.1,同样的问题 –