Skip to content

Instantly share code, notes, and snippets.

@MiguelSavignano
Created November 8, 2016 00:39
Show Gist options
  • Save MiguelSavignano/b84cda320fd5f79b16350f301742e4dd to your computer and use it in GitHub Desktop.
Save MiguelSavignano/b84cda320fd5f79b16350f301742e4dd to your computer and use it in GitHub Desktop.
rails setting mongoid
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