Sha256: ad93e8d5a83fc9cda96f2f43127ba6c2b5b86689d36c99967d48d1a46d48d929
Contents?: true
Size: 602 Bytes
Versions: 2
Compression:
Stored size: 602 Bytes
Contents
module TokenAction module Model extend ActiveSupport::Concern include TokenAction::TokenGenerator included do validates_presence_of :token, :kind # ActiveRecord, Mongoid, MongoMapper and DataMapper implement # `validates_uniqueness_of`. Sequel implements it in a plugin. # # @see http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Plugins/ValidationClassMethods.html validates_uniqueness_of :token before_validation :set_token end private def set_token self.token ||= self.class.generate_token(:token) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
token_action-0.0.2 | lib/token_action/concerns/model.rb |
token_action-0.0.1 | lib/token_action/mixins/model.rb |