Hello There,
I have 4 models and i have very important reason to update all models (maybe separate but in 1 action if possible)
If i want to update 1 model i can use
def update
@modelA = ModelA.find(params[:id]
respond_to do |format|
if @modelA.update(modelA_params)
format.html { redirect_to :back, notice: "" }
format.json { head :no_content }
else
format.json { render json: @modelA.errors, status: :unprocessable_entity }
format.html { render :show }
end
end
end
with appropriate params...but i consider how it works if i have Configuration page and i want to update 4 models...i mean i have 4 columns for each model and i want to update in each column appropriate attribute from model. (In my case x-editable gem to update attribute for appropriate model)
The question is...there is any hack for that? like batch update with case condition or should i create update action for every model to update them?
