Created
November 8, 2016 00:39
-
-
Save MiguelSavignano/b84cda320fd5f79b16350f301742e4dd to your computer and use it in GitHub Desktop.
rails setting mongoid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Setting | |
include Mongoid::Document | |
field :support_email, type: String, default: "" | |
def self.method_missing(method, *agrs, &block) | |
_initialize unless first | |
first.send(method, *agrs, &block) | |
end | |
private | |
def self._initialize | |
Setting.create | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment