Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthoroisucf
     
    Hello Folks.

    I just got done building a application using Akelos. My boss goes into the application for the first time and inputs some data and he immediately makes it blows up with an error and I look like an idiot.

    As it tuns out Akelos does a great job of escaping input data, but I assumed active_record was enforcing field input lengths based on the database column size.

    So how do I easily go about enforcing input field lengths in Akelos? The default varchar lengths is 255. If someone enters a string longer than that it blows up on the insert. Without using javascript how do I keep users from typing in more into the form than the database column size?

    -Daniel
    • CommentAuthoroisucf
     
    Ok. I think figured it out. I was using 'size' when I also needed to use 'maxlength' in the views.
    • CommentAuthorKaste
     

    that's not enough. try:

    AkActiveRecord::validatesLengthOf(...)
    
    • CommentAuthoroisucf
     
    That is a worthless suggestion for a fix. That means I have to populate every model with AkActiveRecord::validatesLengthOf for every single field in the model's database just to keep users from entering data longer than the field's length. The whole idea of Active Record is that the database schema dictates the rules. The input helper should be setting the maxlength based on the actual field length in the database.
    •  
      CommentAuthorbermi
     

    @oisucf, if you update to rev.1207 you'll find the behaviour you expect after adding to your shared_model.php

    var $_automated_validators_enabled = true;
    var $_automated_max_length_validator = true;
    var $_automated_not_null_validator = true;