lib/engine2/meta/save_meta.rb in engine2-1.0.1 vs lib/engine2/meta/save_meta.rb in engine2-1.0.2
- old
+ new
@@ -2,11 +2,10 @@
module Engine2
class SaveMeta < Meta
include MetaApproveSupport
- http_method :post
def validate_and_approve handler, record, json
record.skip_save_refresh = true
record.raise_on_save_failure = false
model = assets[:model]
@@ -26,11 +25,11 @@
(model.validation_in_transaction || mtm_insert) ? model.db.transaction(&save) : save.(nil)
end
end
class InsertMeta < SaveMeta
- meta_type :save
+ meta_type :approve
def allocate_record handler, json
record = super(handler, json)
record.instance_variable_set(:"@new", true)
model = assets[:model]
model.primary_keys.each{|k|record.values.delete k} unless model.natural_key
@@ -38,26 +37,14 @@
record
end
end
class UpdateMeta < SaveMeta
- meta_type :save
+ meta_type :approve
def allocate_record handler, json
record = super(handler, json)
model = assets[:model]
handler.permit record.has_primary_key? unless model.natural_key
record
- end
- end
-
- module TimeStampMeta
- def before_approve handler, record
- super
- puts "before approve"
- end
-
- def after_approve handler, record
- super
- puts "after approve"
end
end
end