Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def self.max_allowed_packet
  2. r = connection.execute "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"
  3. r.fetch_row.last.to_i rescue 128.megabytes
  4. end
  5. validates_length_of :data, :in => 1 .. max_allowed_packet,
  6. :allow_blank => true
  7. validates_length_of :file, :in => 1 .. max_allowed_packet,
  8. :allow_blank => true
Add Comment
Please, Sign In to add comment