Add check for rails 4.0
Use as_json vs to_json

was causing stack overflow
Instantiate builder for validator hash