Rails : ActiveRecord StatementInvalid Mysql2 Error Out of range value for column -


i need way in rails 4 through can validate data in multiple models based on different type of column. have application has several models each model has various columns. need validate each attribute value based on type of column not generate

activerecord::statementinvalid mysql2::error: out of range value column 

i have strict_all_tables mode in mysql in application. strict_all_tables set false , had set true. need validate decimal different precision , scale (based on different model), string value within string range of (255 character) , on.. tried handle exception handling in controller doesn't give validation failure model.

rescue_from activerecord::statementinvalid, with: :statement_invalid def statement_invalid(exception)   respond_to |format|     format.js { render json: { message: 'not found' }, status: 404 }     format.json { render json: { message: 'not found' }, status: 404 }     format.html { render 'shared/page_not_found', status: 404 }   end end 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -