You can chain validations so add the maximum constraint to line 14:

validates :name, :presence => true, maximum => 255