First version of new preview. Only plain text

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-09-04 12:31:27 +08:00
1 parent ecb3b5b25c
commit 671f86b612
14 files changed
+100 -14

No files matched your search

+13
View File
@@ -1,4 +1,17 @@
module OrbitCoreLib
module Preview
def self.included(base)
base.instance_eval("field :is_preview,type: Boolean,:default => false")
base.instance_eval("scope :not_preview,where(:is_preview=>false)")
base.define_singleton_method :new_preview do |*args|
temp_obj = self.new(args.first)
temp_obj.is_preview = true
temp_obj.save(:validate => false) rescue
temp_obj
end
end
end
module BelongsToCategoryMayDisable
def self.included(base)
base.instance_eval("belongs_to :#{base::BelongsToCategory.to_s}")