lib/alchemy/custom/model/order.rb in alchemy-custom-model-2.0.1 vs lib/alchemy/custom/model/order.rb in alchemy-custom-model-2.0.2
- old
+ new
@@ -29,20 +29,29 @@
end
end
def update
+ if !self.class.method_for_show.blank?
+ klass= klass_for_show_elements
+ else
+ klass= self.parent_klass
+ end
updated_nodes = params[:ordered_data]
- self.parent_klass.transaction do
- process_nodes updated_nodes, self.parent_klass
+ klass.transaction do
+ process_nodes updated_nodes, klass
end
redirect_to polymorphic_path([:admin, self.parent_klass])
end
protected
def parent_klass
self.class.parent_klass
+ end
+
+ def klass_for_show_elements
+ self.class.method_for_show.to_s.singularize.classify.constantize
end
private
def check_parent
\ No newline at end of file