From 1fc546b06fbea8a0a598d86cd35fcf1a8aef32da Mon Sep 17 00:00:00 2001 From: 42thcoder <42thcoder@gmail.com> Date: Wed, 19 Feb 2014 20:31:32 +0800 Subject: [PATCH] tmp --- lib/my_mongoid.rb | 8 +++----- lib/my_mongoid/field.rb | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 lib/my_mongoid/field.rb diff --git a/lib/my_mongoid.rb b/lib/my_mongoid.rb index 5a9e750..cd6787b 100644 --- a/lib/my_mongoid.rb +++ b/lib/my_mongoid.rb @@ -1,10 +1,12 @@ require "my_mongoid/version" +require 'my_mongoid/field' require 'active_support/concern' module MyMongoid module Document extend ActiveSupport::Concern + include Field @@models = [] @@ -46,11 +48,7 @@ module ClassMethods def is_mongoid_model? true end - - def field - - end end - end + end end diff --git a/lib/my_mongoid/field.rb b/lib/my_mongoid/field.rb new file mode 100644 index 0000000..3535b74 --- /dev/null +++ b/lib/my_mongoid/field.rb @@ -0,0 +1,21 @@ +require "my_mongoid/version" +require 'active_support/concern' + +module MyMongoid + + module Field + extend ActiveSupport::Concern + + included do + + end + + module ClassMethods + def field(name) + self.class_eval do + attr_accessor :public + end + end + end + end +end