新手问题 这段代码是什么意思?

xcc7624 · November 29, 2014 · Last by marksloan replied at January 31, 2015 · 1708 hits
class CreateLocalKeys < ActiveRecord::Migration
  include Crypto
  def self.up
    # Identifier for the tracker
    File.open("identifier", "w") do |f|
      f.write UUID.new
    end unless File.exist?("identifier")
    # RSA keys for user authentication
    Crypto.create_keys
  end

  def self.down
  end
end

在本地 identier 文件中写入一个 UUID,然后用这个 UUID 生成加密用的 key,用的是 Crypto 这个类里做好的生成 key 的代码。

#1 楼 @marksloan # Identifier for the tracker 是什么意思。

#1 楼 @marksloan rails 在使用 rake db:migrate 时候应用的根目录中 lib 中定义的模块会自动加载吗?

4 Floor has deleted
You need to Sign in before reply, if you don't have an account, please Sign up first.