Rails 4 ããå ¥ã app/models/concerens ã使ãã class User < AR::Base include Cryptable end ã app/models/user.rb ã«ä½ã£ã¦ module Cryptable def password BCrypt::Password.new(read_attribute(:password)) end def password=(password) write_attribute(:password, BCrypt::Password.create(password)) end end ã¿ãããªã³ã¼ãã app/models/concerns/cryptable.rb ã«ä½ãã ãã 便å©ãªã®ã§æ´»ç¨ãã¦ãããããããã app/models/concerns/user/cryptable.rb ã¨ãã«ãã㨠inc
{{#tags}}- {{label}}
{{/tags}}