Hacker News new | ask | show | jobs
by tptacek 5786 days ago
Yeah, bcrypt-ruby already does that, doesn't it?
1 comments

Thats up to you to decide, here a comparison:

Here is bcrypt-ruby

  class User < ActiveRecord::Base

    include BCrypt

    def password
      @password ||= Password.new(password_hash)
    end

    def password=(new_password)
      @password = Password.create(new_password)
      self.password_hash = @password
    end

  end
Here is auto_hash

  class User < ActiveRecord::Base
    auto_hash :password
  end
Not sure I'd want to introduce a plugin dep to get rid of 7 lines of code (you don't need the "include"), but, OK.