module Fiona7 class ReleaseController < ActionController::Base def release @releasable = Set.new @obj = WriteObj.find(params[:id]) @releasable.merge(widgets(@obj)) @releasable << @obj @releasable.each do |obj| obj.release! if obj.really_edited? end render json: {} end protected def widgets(obj) links = @obj[:X_widget_pool] || [] WriteObj.where(obj_id: links.map {|l| l.destination_object_id }).to_a end end end